The previous patch did not catch SIGINT, which is used by the
kernel to indicate to the init process that the system should
reboot.
Signed-off-by: Michel Stam <m.stam@fugro.nl>
uloop_run();
uloop_done();
- if (getpid() == 1)
- procd_shutdown(RB_AUTOBOOT);
-
return 0;
}
char *msg = NULL;
switch(signal) {
+ case SIGINT:
case SIGTERM:
event = RB_AUTOBOOT;
msg = "reboot";
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);
break;
case STATE_HALT:
+ // To prevent killed processes from interrupting the sleep
+ signal(SIGCHLD, SIG_IGN);
LOG("- SIGTERM processes -\n");
kill(-1, SIGTERM);
sync();