From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 209F5138010 for ; Wed, 12 Sep 2012 19:00:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6BFCF21C078; Wed, 12 Sep 2012 19:00:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3EE0521C068 for ; Wed, 12 Sep 2012 19:00:29 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A6A9C33CF45 for ; Wed, 12 Sep 2012 19:00:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 63AE1E543C for ; Wed, 12 Sep 2012 19:00:27 +0000 (UTC) From: "Christian Ruppert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Christian Ruppert" Message-ID: <1347476420.a06072b3959adc91ddf5157f69162977cbd48079.idl0r@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/_usage.h src/rc/start-stop-daemon.c X-VCS-Directories: src/rc/ X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: a06072b3959adc91ddf5157f69162977cbd48079 X-VCS-Branch: master Date: Wed, 12 Sep 2012 19:00:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fe08a2e4-b824-43f9-80db-a02eb208d29b X-Archives-Hash: e4e6869a615f174951ad6d63d9d463b5 commit: a06072b3959adc91ddf5157f69162977cbd48079 Author: Christian Ruppert gentoo org> AuthorDate: Wed Sep 12 19:00:20 2012 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Wed Sep 12 19:00:20 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=a06072b3 Silence get_pid(), OpenRC will give the process some time to create the PID file and the first get__pid() call may fail. --- src/rc/_usage.h | 2 +- src/rc/start-stop-daemon.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rc/_usage.h b/src/rc/_usage.h index 84b66b9..0882c22 100644 --- a/src/rc/_usage.h +++ b/src/rc/_usage.h @@ -38,7 +38,7 @@ "Disable color output", \ "Display software version", \ "Run verbosely", \ - "Run quietly" + "Run quietly (Does not affect errors)" #define case_RC_COMMON_getopt_case_C setenv ("EINFO_COLOR", "NO", 1); #define case_RC_COMMON_getopt_case_h usage (EXIT_SUCCESS); diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index a3d887a..7c24ead 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -305,7 +305,7 @@ parse_schedule(const char *string, int timeout) } static pid_t -get_pid(const char *pidfile) +get_pid(const char *pidfile, bool quiet) { FILE *fp; pid_t pid; @@ -314,12 +314,14 @@ get_pid(const char *pidfile) return -1; if ((fp = fopen(pidfile, "r")) == NULL) { - eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); + if(!quiet) + eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); return -1; } if (fscanf(fp, "%d", &pid) != 1) { - eerror("%s: no pid found in `%s'", applet, pidfile); + if(!quiet) + eerror("%s: no pid found in `%s'", applet, pidfile); fclose(fp); return -1; } @@ -413,7 +415,7 @@ run_stop_schedule(const char *exec, const char *const *argv, } if (pidfile) { - pid = get_pid(pidfile); + pid = get_pid(pidfile, false); if (pid == -1) return 0; } @@ -1079,7 +1081,7 @@ start_stop_daemon(int argc, char **argv) } if (pidfile) - pid = get_pid(pidfile); + pid = get_pid(pidfile, false); else pid = 0; @@ -1352,7 +1354,7 @@ start_stop_daemon(int argc, char **argv) alive = true; } else { if (pidfile) { - pid = get_pid(pidfile); + pid = get_pid(pidfile, true); if (pid == -1) { eerrorx("%s: did not " "create a valid"