aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-02-01 13:20:19 +0000
committerRoy Marples <roy@marples.name>2008-02-01 13:20:19 +0000
commitf2ce40d90b92f6049745f6f06191bd43b6b931dd (patch)
treebc64ec292bbe407b420f6795ce1da7cc4e01c08a /src/rc/rc.c
parent01e148d29d643af342a67bfa2f70928d6a6e0b75 (diff)
Use sigaction over signal.
Diffstat (limited to 'src/rc/rc.c')
-rw-r--r--src/rc/rc.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/rc/rc.c b/src/rc/rc.c
index 4205c4fb..954d6b59 100644
--- a/src/rc/rc.c
+++ b/src/rc/rc.c
@@ -441,6 +441,7 @@ static void handle_signal (int sig)
pid_t pid;
int status = 0;
struct winsize ws;
+ sigset_t sset;
switch (sig) {
case SIGCHLD:
@@ -480,9 +481,13 @@ static void handle_signal (int sig)
/* NOTREACHED */
case SIGUSR1:
eerror ("rc: Aborting!");
- /* Kill any running services we have started */
- signal (SIGCHLD, SIG_IGN);
+ /* Block child signals */
+ sigemptyset (&sset);
+ sigaddset (&sset, SIGCHLD);
+ sigprocmask (SIG_BLOCK, &sset, NULL);
+
+ /* Kill any running services we have started */
for (pl = service_pids; pl; pl = pl->next)
kill (pl->pid, SIGTERM);
@@ -761,12 +766,12 @@ int main (int argc, char **argv)
rc_logger_open (newlevel ? newlevel : runlevel);
/* Setup a signal handler */
- signal (SIGINT, handle_signal);
- signal (SIGQUIT, handle_signal);
- signal (SIGTERM, handle_signal);
- signal (SIGUSR1, handle_signal);
- signal (SIGWINCH, handle_signal);
-
+ signal_setup (SIGINT, handle_signal);
+ signal_setup (SIGQUIT, handle_signal);
+ signal_setup (SIGTERM, handle_signal);
+ signal_setup (SIGUSR1, handle_signal);
+ signal_setup (SIGWINCH, handle_signal);
+
if (! rc_yesno (getenv ("EINFO_QUIET")))
interactive = exists (INTERACTIVE);
rc_plugin_load ();
@@ -871,7 +876,7 @@ int main (int argc, char **argv)
}
/* Now we start handling our children */
- signal (SIGCHLD, handle_signal);
+ signal_setup (SIGCHLD, handle_signal);
/* We should only use ksoftlevel if we were in single user mode
* If not, we need to erase ksoftlevel now. */