start-stop-daemon: fix --quiet switch
The --quiet switch wasn't really quiet, because we changed it to report errors. I am changing it back due to discussions on the listed bugs. X-Gentoo-Bug: 482396 X-Gentoo-Bug: 439174 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=482396 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=439174
This commit is contained in:
parent
d1b183a2f9
commit
bb8a9c087d
@ -38,7 +38,7 @@
|
|||||||
"Disable color output", \
|
"Disable color output", \
|
||||||
"Display software version", \
|
"Display software version", \
|
||||||
"Run verbosely", \
|
"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_C setenv ("EINFO_COLOR", "NO", 1);
|
||||||
#define case_RC_COMMON_getopt_case_h usage (EXIT_SUCCESS);
|
#define case_RC_COMMON_getopt_case_h usage (EXIT_SUCCESS);
|
||||||
|
@ -417,7 +417,7 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pidfile) {
|
if (pidfile) {
|
||||||
pid = get_pid(pidfile, false);
|
pid = get_pid(pidfile, quiet);
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -436,6 +436,7 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
|||||||
if (tkilled == 0) {
|
if (tkilled == 0) {
|
||||||
if (progressed)
|
if (progressed)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
if (! quiet)
|
||||||
eerror("%s: no matching processes found", applet);
|
eerror("%s: no matching processes found", applet);
|
||||||
}
|
}
|
||||||
return tkilled;
|
return tkilled;
|
||||||
@ -506,10 +507,12 @@ run_stop_schedule(const char *exec, const char *const *argv,
|
|||||||
|
|
||||||
if (progressed)
|
if (progressed)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
if (nrunning == 1)
|
if (! quiet) {
|
||||||
eerror("%s: %d process refused to stop", applet, nrunning);
|
if (nrunning == 1)
|
||||||
else
|
eerror("%s: %d process refused to stop", applet, nrunning);
|
||||||
eerror("%s: %d process(es) refused to stop", applet, nrunning);
|
else
|
||||||
|
eerror("%s: %d process(es) refused to stop", applet, nrunning);
|
||||||
|
}
|
||||||
|
|
||||||
return -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 */
|
/* We don't redirect stdin as some daemons may need it */
|
||||||
if (background || quiet || redirect_stdout)
|
if (background || quiet || redirect_stdout)
|
||||||
dup2(stdout_fd, STDOUT_FILENO);
|
dup2(stdout_fd, STDOUT_FILENO);
|
||||||
if (background || redirect_stderr)
|
if (background || quiet || redirect_stderr)
|
||||||
dup2(stderr_fd, STDERR_FILENO);
|
dup2(stderr_fd, STDERR_FILENO);
|
||||||
|
|
||||||
for (i = getdtablesize() - 1; i >= 3; --i)
|
for (i = getdtablesize() - 1; i >= 3; --i)
|
||||||
@ -1320,9 +1323,11 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} while (!WIFEXITED(i) && !WIFSIGNALED(i));
|
} while (!WIFEXITED(i) && !WIFSIGNALED(i));
|
||||||
if (!WIFEXITED(i) || WEXITSTATUS(i) != 0)
|
if (!WIFEXITED(i) || WEXITSTATUS(i) != 0) {
|
||||||
eerrorx("%s: failed to start `%s'", applet, exec);
|
if (!quiet)
|
||||||
|
eerrorx("%s: failed to start `%s'", applet, exec);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
pid = spid;
|
pid = spid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1356,7 +1361,7 @@ start_stop_daemon(int argc, char **argv)
|
|||||||
alive = true;
|
alive = true;
|
||||||
} else {
|
} else {
|
||||||
if (pidfile) {
|
if (pidfile) {
|
||||||
pid = get_pid(pidfile, false);
|
pid = get_pid(pidfile, true);
|
||||||
if (pid == -1) {
|
if (pid == -1) {
|
||||||
eerrorx("%s: did not "
|
eerrorx("%s: did not "
|
||||||
"create a valid"
|
"create a valid"
|
||||||
|
Loading…
Reference in New Issue
Block a user