commit: 382efdbfcb99703d03211efacd800c9575e64230
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Sep 6 21:43:28 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Sep 6 22:22:35 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=382efdbf
add quiet parameter to run_stop_schedule
src/rc/rc-schedules.c | 11 ++++++-----
src/rc/rc-schedules.h | 2 +-
src/rc/start-stop-daemon.c | 2 +-
src/rc/supervise-daemon.c | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c
index 7eb28372..1b235a8d 100644
--- a/src/rc/rc-schedules.c
+++ b/src/rc/rc-schedules.c
@@ -298,7 +298,7 @@ int do_stop(const char *applet, const char *exec, const
char *const *argv,
int run_stop_schedule(const char *applet,
const char *exec, const char *const *argv,
pid_t pid, uid_t uid,
- bool test, bool progress)
+ bool test, bool progress, bool quiet)
{
SCHEDULEITEM *item = TAILQ_FIRST(&schedule);
int nkilled = 0;
@@ -409,10 +409,11 @@ int run_stop_schedule(const char *applet,
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;
}
diff --git a/src/rc/rc-schedules.h b/src/rc/rc-schedules.h
index 0a10b381..a42ea0e3 100644
--- a/src/rc/rc-schedules.h
+++ b/src/rc/rc-schedules.h
@@ -22,6 +22,6 @@ int do_stop(const char *applet, const char *exec, const char
*const *argv,
int run_stop_schedule(const char *applet,
const char *exec, const char *const *argv,
pid_t pid, uid_t uid,
- bool test, bool progress);
+ bool test, bool progress, bool quiet);
#endif
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index 4cda6102..46784b26 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -657,7 +657,7 @@ int main(int argc, char **argv)
else
parse_schedule(applet, NULL, sig);
i = run_stop_schedule(applet, exec, (const char *const *)margv,
- get_pid(applet, pidfile), uid, test, progress);
+ get_pid(applet, pidfile), uid, test, progress, false);
if (i < 0)
/* We failed to stop something */
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 3923dab5..a702a25c 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -755,7 +755,7 @@ int main(int argc, char **argv)
if (exiting) {
syslog(LOG_INFO, "stopping %s, pid %d", exec,
child_pid);
nkilled = run_stop_schedule(applet, exec, NULL,
child_pid,
- 0, false, false);
+ 0, false, false, true);
if (nkilled > 0)
syslog(LOG_INFO, "killed %d processes",
nkilled);
} else {