diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rc/_usage.h | 2 | ||||
-rw-r--r-- | src/rc/start-stop-daemon.c | 25 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/rc/_usage.h b/src/rc/_usage.h index 0882c22f..84b66b96 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 (Does not affect errors)" + "Run quietly" #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 5576d49d..4b9fcdd0 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -417,7 +417,7 @@ run_stop_schedule(const char *exec, const char *const *argv, } if (pidfile) { - pid = get_pid(pidfile, false); + pid = get_pid(pidfile, quiet); if (pid == -1) return 0; } @@ -436,6 +436,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); } return tkilled; @@ -506,10 +507,12 @@ run_stop_schedule(const char *exec, const char *const *argv, if (progressed) printf("\n"); - if (nrunning == 1) - eerror("%s: %d process refused to stop", applet, nrunning); - else - eerror("%s: %d process(es) refused to stop", applet, nrunning); + 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); + } return -nrunning; } @@ -1289,7 +1292,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 || redirect_stderr) + if (background || quiet || redirect_stderr) dup2(stderr_fd, STDERR_FILENO); for (i = getdtablesize() - 1; i >= 3; --i) @@ -1320,9 +1323,11 @@ start_stop_daemon(int argc, char **argv) return -1; } } while (!WIFEXITED(i) && !WIFSIGNALED(i)); - if (!WIFEXITED(i) || WEXITSTATUS(i) != 0) - eerrorx("%s: failed to start `%s'", applet, exec); - + if (!WIFEXITED(i) || WEXITSTATUS(i) != 0) { + if (!quiet) + eerrorx("%s: failed to start `%s'", applet, exec); + exit(EXIT_FAILURE); + } pid = spid; } @@ -1356,7 +1361,7 @@ start_stop_daemon(int argc, char **argv) alive = true; } else { if (pidfile) { - pid = get_pid(pidfile, false); + pid = get_pid(pidfile, true); if (pid == -1) { eerrorx("%s: did not " "create a valid" |