diff options
author | Isaac Dunham <ibid.ag@gmail.com> | 2015-08-20 11:49:16 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-08-20 11:49:16 -0500 |
commit | 92f3b785690f5c23e1b84b6e726d7859d0ab1608 (patch) | |
tree | 327dc8a73c8e58c1356d320bc4081b66491f2dab | |
parent | 4e49e2cca731f2e1dd01ebc5163beb71e0d640ec (diff) | |
download | toybox-92f3b785690f5c23e1b84b6e726d7859d0ab1608.tar.gz |
I discovered that the reason SIGINT causes a reboot on sysvinit is that
it's how the kernel signals that ctrl-alt-delete has been pressed;
thus, setting it as the signal for reboot prevents ctrlaltdel scripts
from working.
SIGTERM is what Busybox uses, so we might as well be compatible.
-rw-r--r-- | toys/other/reboot.c | 2 | ||||
-rw-r--r-- | toys/pending/init.c | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/toys/other/reboot.c b/toys/other/reboot.c index 1e8f5e9b..15eea285 100644 --- a/toys/other/reboot.c +++ b/toys/other/reboot.c @@ -25,7 +25,7 @@ config REBOOT void reboot_main(void) { int types[] = {RB_AUTOBOOT, RB_HALT_SYSTEM, RB_POWER_OFF}, - sigs[] = {SIGINT, SIGUSR1, SIGUSR2}, idx; + sigs[] = {SIGTERM, SIGUSR1, SIGUSR2}, idx; if (!(toys.optflags & FLAG_n)) sync(); diff --git a/toys/pending/init.c b/toys/pending/init.c index d9e78ff4..64b61481 100644 --- a/toys/pending/init.c +++ b/toys/pending/init.c @@ -348,7 +348,6 @@ static void halt_poweroff_reboot_handler(int sig_no) reboot_magic_no=RB_POWER_OFF; break; case SIGTERM: - case SIGINT: error_msg("Requesting system reboot"); reboot_magic_no=RB_AUTOBOOT; break; @@ -464,7 +463,6 @@ void init_main(void) xsignal(SIGUSR1, halt_poweroff_reboot_handler);//halt xsignal(SIGUSR2, halt_poweroff_reboot_handler);//poweroff xsignal(SIGTERM, halt_poweroff_reboot_handler);//reboot - xsignal(SIGINT, halt_poweroff_reboot_handler);//reboot xsignal(SIGQUIT, restart_init_handler);//restart init memset(&sig_act, 0, sizeof(sig_act)); sigfillset(&sig_act.sa_mask); @@ -473,6 +471,7 @@ void init_main(void) sigaction(SIGTSTP, &sig_act, NULL); memset(&sig_act, 0, sizeof(sig_act)); sig_act.sa_handler = catch_signal; + sigaction(SIGINT, &sig_act, NULL); sigaction(SIGHUP, &sig_act, NULL); run_action_from_list(SYSINIT); check_if_pending_signals(); |