diff options
Diffstat (limited to 'init')
-rw-r--r-- | init/init.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/init/init.c b/init/init.c index 9e24817b7..080c5b3af 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -319,15 +319,17 @@ static pid_t run(const struct init_action *a) | |||
319 | /* Child */ | 319 | /* Child */ |
320 | 320 | ||
321 | /* Reset signal handlers that were set by the parent process */ | 321 | /* Reset signal handlers that were set by the parent process */ |
322 | signal(SIGUSR1, SIG_DFL); | 322 | bb_signals(0 |
323 | signal(SIGUSR2, SIG_DFL); | 323 | + (1 << SIGUSR1) |
324 | signal(SIGINT, SIG_DFL); | 324 | + (1 << SIGUSR2) |
325 | signal(SIGTERM, SIG_DFL); | 325 | + (1 << SIGINT) |
326 | signal(SIGHUP, SIG_DFL); | 326 | + (1 << SIGTERM) |
327 | signal(SIGQUIT, SIG_DFL); | 327 | + (1 << SIGHUP) |
328 | signal(SIGCONT, SIG_DFL); | 328 | + (1 << SIGQUIT) |
329 | signal(SIGSTOP, SIG_DFL); | 329 | + (1 << SIGCONT) |
330 | signal(SIGTSTP, SIG_DFL); | 330 | + (1 << SIGSTOP) |
331 | + (1 << SIGTSTP) | ||
332 | , SIG_DFL); | ||
331 | 333 | ||
332 | /* Create a new session and make ourself the process | 334 | /* Create a new session and make ourself the process |
333 | * group leader */ | 335 | * group leader */ |
@@ -349,9 +351,11 @@ static pid_t run(const struct init_action *a) | |||
349 | 351 | ||
350 | if (pid > 0) { | 352 | if (pid > 0) { |
351 | /* Parent - wait till the child is done */ | 353 | /* Parent - wait till the child is done */ |
352 | signal(SIGINT, SIG_IGN); | 354 | bb_signals(0 |
353 | signal(SIGTSTP, SIG_IGN); | 355 | + (1 << SIGINT) |
354 | signal(SIGQUIT, SIG_IGN); | 356 | + (1 << SIGTSTP) |
357 | + (1 << SIGQUIT) | ||
358 | , SIG_IGN); | ||
355 | signal(SIGCHLD, SIG_DFL); | 359 | signal(SIGCHLD, SIG_DFL); |
356 | 360 | ||
357 | waitfor(pid); | 361 | waitfor(pid); |
@@ -864,15 +868,21 @@ int init_main(int argc, char **argv) | |||
864 | } | 868 | } |
865 | /* Set up sig handlers -- be sure to | 869 | /* Set up sig handlers -- be sure to |
866 | * clear all of these in run() */ | 870 | * clear all of these in run() */ |
867 | signal(SIGHUP, exec_restart_action); | 871 | bb_signals(0 |
868 | signal(SIGQUIT, exec_restart_action); | 872 | + (1 << SIGHUP) |
869 | signal(SIGUSR1, halt_reboot_pwoff); /* halt */ | 873 | + (1 << SIGQUIT) |
870 | signal(SIGUSR2, halt_reboot_pwoff); /* poweroff */ | 874 | , exec_restart_action); |
871 | signal(SIGTERM, halt_reboot_pwoff); /* reboot */ | 875 | bb_signals(0 |
876 | + (1 << SIGUSR1) /* halt */ | ||
877 | + (1 << SIGUSR2) /* poweroff */ | ||
878 | + (1 << SIGTERM) /* reboot */ | ||
879 | , halt_reboot_pwoff); | ||
872 | signal(SIGINT, ctrlaltdel_signal); | 880 | signal(SIGINT, ctrlaltdel_signal); |
873 | signal(SIGCONT, cont_handler); | 881 | signal(SIGCONT, cont_handler); |
874 | signal(SIGSTOP, stop_handler); | 882 | bb_signals(0 |
875 | signal(SIGTSTP, stop_handler); | 883 | + (1 << SIGSTOP) |
884 | + (1 << SIGTSTP) | ||
885 | , stop_handler); | ||
876 | 886 | ||
877 | /* Turn off rebooting via CTL-ALT-DEL -- we get a | 887 | /* Turn off rebooting via CTL-ALT-DEL -- we get a |
878 | * SIGINT on CAD so we can shut things down gracefully... */ | 888 | * SIGINT on CAD so we can shut things down gracefully... */ |