aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rc/rc-schedules.c13
-rw-r--r--src/rc/rc-schedules.h2
-rw-r--r--src/rc/start-stop-daemon.c4
-rw-r--r--src/rc/supervise-daemon.c7
4 files changed, 13 insertions, 13 deletions
diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c
index 1b235a8d..13f615ee 100644
--- a/src/rc/rc-schedules.c
+++ b/src/rc/rc-schedules.c
@@ -253,7 +253,7 @@ void parse_schedule(const char *applet, const char *string, int timeout)
/* return number of processes killed, -1 on error */
int do_stop(const char *applet, const char *exec, const char *const *argv,
- pid_t pid, uid_t uid,int sig, bool test)
+ pid_t pid, uid_t uid,int sig, bool test, bool quiet)
{
RC_PIDLIST *pids;
RC_PID *pi;
@@ -274,11 +274,13 @@ int do_stop(const char *applet, const char *exec, const char *const *argv,
einfo("Would send signal %d to PID %d", sig, pi->pid);
nkilled++;
} else {
- ebeginv("Sending signal %d to PID %d", sig, pi->pid);
+ if (!quiet)
+ ebeginv("Sending signal %d to PID %d", sig, pi->pid);
errno = 0;
killed = (kill(pi->pid, sig) == 0 ||
errno == ESRCH ? true : false);
- eendv(killed ? 0 : 1,
+ if (! quiet)
+ eendv(killed ? 0 : 1,
"%s: failed to send signal %d to PID %d: %s",
applet, sig, pi->pid, strerror(errno));
if (!killed) {
@@ -335,7 +337,8 @@ int run_stop_schedule(const char *applet,
case SC_SIGNAL:
nrunning = 0;
- nkilled = do_stop(applet, exec, argv, pid, uid, item->value, test);
+ nkilled = do_stop(applet, exec, argv, pid, uid, item->value, test,
+ quiet);
if (nkilled == 0) {
if (tkilled == 0) {
if (progressed)
@@ -364,7 +367,7 @@ int run_stop_schedule(const char *applet,
nloops++)
{
if ((nrunning = do_stop(applet, exec, argv,
- pid, uid, 0, test)) == 0)
+ pid, uid, 0, test, quiet)) == 0)
return 0;
diff --git a/src/rc/rc-schedules.h b/src/rc/rc-schedules.h
index a42ea0e3..234e62df 100644
--- a/src/rc/rc-schedules.h
+++ b/src/rc/rc-schedules.h
@@ -18,7 +18,7 @@ void free_schedulelist(void);
int parse_signal(const char *applet, const char *sig);
void parse_schedule(const char *applet, const char *string, int timeout);
int do_stop(const char *applet, const char *exec, const char *const *argv,
- pid_t pid, uid_t uid,int sig, bool test);
+ pid_t pid, uid_t uid,int sig, bool test, bool quiet);
int run_stop_schedule(const char *applet,
const char *exec, const char *const *argv,
pid_t pid, uid_t uid,
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index 46784b26..dab8b3b1 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -684,7 +684,7 @@ int main(int argc, char **argv)
pid = 0;
if (do_stop(applet, exec, (const char * const *)margv, pid, uid,
- 0, test) > 0)
+ 0, test, false) > 0)
eerrorx("%s: %s is already running", applet, exec);
if (test) {
@@ -964,7 +964,7 @@ int main(int argc, char **argv)
} else
pid = 0;
if (do_stop(applet, exec, (const char *const *)margv,
- pid, uid, 0, test) > 0)
+ pid, uid, 0, test, false) > 0)
alive = true;
}
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index a702a25c..7b894e7b 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -440,11 +440,6 @@ int main(int argc, char **argv)
applet = basename_c(argv[0]);
atexit(cleanup);
- signal_setup(SIGINT, handle_signal);
- signal_setup(SIGQUIT, handle_signal);
- signal_setup(SIGTERM, handle_signal);
- openlog(applet, LOG_PID, LOG_DAEMON);
-
if ((tmp = getenv("SSD_NICELEVEL")))
if (sscanf(tmp, "%d", &nicelevel) != 1)
eerror("%s: invalid nice level `%s' (SSD_NICELEVEL)",
@@ -729,6 +724,8 @@ int main(int argc, char **argv)
if (child_pid != 0) {
/* this is the supervisor */
umask(numask);
+ openlog(applet, LOG_PID, LOG_DAEMON);
+ signal_setup(SIGTERM, handle_signal);
fp = fopen(pidfile, "w");
if (! fp)