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 A1E4B138010 for ; Sat, 18 Aug 2012 22:26:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 89D1AE05EB; Sat, 18 Aug 2012 22:26:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 44B2BE05EB for ; Sat, 18 Aug 2012 22:26:49 +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 780C31B4033 for ; Sat, 18 Aug 2012 22:26:48 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 0F0B7E5441 for ; Sat, 18 Aug 2012 22:26:47 +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: <1345328798.9afdf50667661812be936fe6d3b3a939b0c54061.idl0r@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/start-stop-daemon.c X-VCS-Directories: src/rc/ X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: 9afdf50667661812be936fe6d3b3a939b0c54061 X-VCS-Branch: master Date: Sat, 18 Aug 2012 22:26:47 +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: d81b88ad-3e4b-48f2-bc1c-807ba5fef911 X-Archives-Hash: e7d5b5191cbdb16791b0381a58ebc5e4 commit: 9afdf50667661812be936fe6d3b3a939b0c54061 Author: Christian Ruppert gentoo org> AuthorDate: Sat Aug 18 22:26:38 2012 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Sat Aug 18 22:26:38 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9afdf506 Do not silence errors --- src/rc/start-stop-daemon.c | 45 +++++++++++++++---------------------------- 1 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index d1eb8a5..a3d887a 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, bool quiet) +get_pid(const char *pidfile) { FILE *fp; pid_t pid; @@ -314,15 +314,12 @@ get_pid(const char *pidfile, bool quiet) return -1; if ((fp = fopen(pidfile, "r")) == NULL) { - if (!quiet) - eerror("%s: fopen `%s': %s", - applet, pidfile, strerror(errno)); + eerror("%s: fopen `%s': %s", applet, pidfile, strerror(errno)); return -1; } if (fscanf(fp, "%d", &pid) != 1) { - if (!quiet) - eerror("%s: no pid found in `%s'", applet, pidfile); + eerror("%s: no pid found in `%s'", applet, pidfile); fclose(fp); return -1; } @@ -355,8 +352,7 @@ do_stop(const char *exec, const char *const *argv, LIST_FOREACH_SAFE(pi, pids, entries, np) { if (test) { if (!quiet) - einfo("Would send signal %d to PID %d", - sig, pi->pid); + einfo("Would send signal %d to PID %d", sig, pi->pid); nkilled++; } else { if (verbose) @@ -417,7 +413,7 @@ run_stop_schedule(const char *exec, const char *const *argv, } if (pidfile) { - pid = get_pid(pidfile, quiet); + pid = get_pid(pidfile); if (pid == -1) return 0; } @@ -436,9 +432,7 @@ run_stop_schedule(const char *exec, const char *const *argv, if (tkilled == 0) { if (progressed) printf("\n"); - if (! quiet) - eerror("%s: no matching " - "processes found", applet); + eerror("%s: no matching processes found", applet); } return tkilled; } @@ -508,14 +502,10 @@ run_stop_schedule(const char *exec, const char *const *argv, if (progressed) printf("\n"); - if (! quiet) { - if (nrunning == 1) - eerror("%s: %d process refused to stop", - applet, nrunning); - else - eerror("%s: %d process(es) refused to stop", - applet, nrunning); - } + if (nrunning == 1) + eerror("%s: %d process refused to stop", applet, nrunning); + else + eerror("%s: %d process(es) refused to stop", applet, nrunning); return -nrunning; } @@ -1089,7 +1079,7 @@ start_stop_daemon(int argc, char **argv) } if (pidfile) - pid = get_pid(pidfile, true); + pid = get_pid(pidfile); else pid = 0; @@ -1295,7 +1285,7 @@ start_stop_daemon(int argc, char **argv) /* We don't redirect stdin as some daemons may need it */ if (background || quiet || redirect_stdout) dup2(stdout_fd, STDOUT_FILENO); - if (background || quiet || redirect_stderr) + if (background || redirect_stderr) dup2(stderr_fd, STDERR_FILENO); for (i = getdtablesize() - 1; i >= 3; --i) @@ -1326,12 +1316,9 @@ start_stop_daemon(int argc, char **argv) return -1; } } while (!WIFEXITED(i) && !WIFSIGNALED(i)); - if (!WIFEXITED(i) || WEXITSTATUS(i) != 0) { - if (!quiet) - eerrorx("%s: failed to start `%s'", - applet, exec); - exit(EXIT_FAILURE); - } + if (!WIFEXITED(i) || WEXITSTATUS(i) != 0) + eerrorx("%s: failed to start `%s'", applet, exec); + pid = spid; } @@ -1365,7 +1352,7 @@ start_stop_daemon(int argc, char **argv) alive = true; } else { if (pidfile) { - pid = get_pid(pidfile, true); + pid = get_pid(pidfile); if (pid == -1) { eerrorx("%s: did not " "create a valid"