aboutsummaryrefslogtreecommitdiff
path: root/src/rc/start-stop-daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rc/start-stop-daemon.c')
-rw-r--r--src/rc/start-stop-daemon.c25
1 files changed, 15 insertions, 10 deletions
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"