diff options
-rw-r--r-- | procd.c | 3 | ||||
-rw-r--r-- | signal.c | 2 | ||||
-rw-r--r-- | state.c | 2 |
3 files changed, 4 insertions, 3 deletions
@@ -72,8 +72,5 @@ int main(int argc, char **argv) uloop_run(); uloop_done(); - if (getpid() == 1) - procd_shutdown(RB_AUTOBOOT); - return 0; } @@ -36,6 +36,7 @@ static void signal_shutdown(int signal, siginfo_t *siginfo, void *data) char *msg = NULL; switch(signal) { + case SIGINT: case SIGTERM: event = RB_AUTOBOOT; msg = "reboot"; @@ -84,6 +85,7 @@ void procd_signal(void) if (getpid() != 1) return; sigaction(SIGTERM, &sa_shutdown, NULL); + sigaction(SIGINT, &sa_shutdown, NULL); sigaction(SIGUSR1, &sa_shutdown, NULL); sigaction(SIGUSR2, &sa_shutdown, NULL); sigaction(SIGSEGV, &sa_crash, NULL); @@ -131,6 +131,8 @@ static void state_enter(void) break; case STATE_HALT: + // To prevent killed processes from interrupting the sleep + signal(SIGCHLD, SIG_IGN); LOG("- SIGTERM processes -\n"); kill(-1, SIGTERM); sync(); |