aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-04-16 08:21:34 +0000
committerMike Frysinger <vapier@gentoo.org>2005-04-16 08:21:34 +0000
commita77b4f39708306d44058d7ca1683f448f51c5fce (patch)
tree79f812d48d525d48a9aec555f7544dbe5653306f
parent63e5e7bf0e903b8f1e1f3208d2bcd63868866207 (diff)
downloadbusybox-a77b4f39708306d44058d7ca1683f448f51c5fce.tar.gz
jfb2 writes in Bug 119:
The init applet will restart (re-exec) itsself when it receives a SIGHUP. However, just before it enters its main loop, it resets SIGHUP to either re-load the inittab (or ignore it if no inittab is used). Thus preventing the re-exec option from being triggerable. This patch adds a signal handler for SIGQUIT for init that always causes init to re-exec itsself (along with killing anything else that might be still running).
-rw-r--r--init/init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/init/init.c b/init/init.c
index 0c8dc89dc..850851173 100644
--- a/init/init.c
+++ b/init/init.c
@@ -453,6 +453,7 @@ static pid_t run(const struct init_action *a)
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_DFL);
+ signal(SIGQUIT, SIG_DFL);
signal(SIGCONT, SIG_DFL);
signal(SIGSTOP, SIG_DFL);
signal(SIGTSTP, SIG_DFL);
@@ -693,6 +694,7 @@ static void shutdown_system(void)
/* first disable all our signals */
sigemptyset(&block_signals);
sigaddset(&block_signals, SIGHUP);
+ sigaddset(&block_signals, SIGQUIT);
sigaddset(&block_signals, SIGCHLD);
sigaddset(&block_signals, SIGUSR1);
sigaddset(&block_signals, SIGUSR2);
@@ -737,6 +739,7 @@ static void exec_signal(int sig)
/* unblock all signals, blocked in shutdown_system() */
sigemptyset(&unblock_signals);
sigaddset(&unblock_signals, SIGHUP);
+ sigaddset(&unblock_signals, SIGQUIT);
sigaddset(&unblock_signals, SIGCHLD);
sigaddset(&unblock_signals, SIGUSR1);
sigaddset(&unblock_signals, SIGUSR2);
@@ -1097,6 +1100,7 @@ extern int init_main(int argc, char **argv)
/* Set up sig handlers -- be sure to
* clear all of these in run() */
signal(SIGHUP, exec_signal);
+ signal(SIGQUIT, exec_signal);
signal(SIGUSR1, halt_signal);
signal(SIGUSR2, halt_signal);
signal(SIGINT, ctrlaltdel_signal);