aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init/init.c3
-rw-r--r--init/log.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c
index ecd3c25..5387043 100644
--- a/init/init.c
+++ b/init/init.c
@@ -103,6 +103,7 @@ int main(void)
static sigset_t set;
sigaddset(&set, SIGCHLD);
sigaddset(&set, SIGINT);
+ sigaddset(&set, SIGTERM);
sigprocmask(SIG_BLOCK, &set, NULL);
while(subsystem_count > 0) {
@@ -119,6 +120,8 @@ int main(void)
}
} else if(sig == SIGINT) {
panic("init: keyboard interrupt");
+ } else if(sig == SIGTERM) {
+ exit(0);
}
}
diff --git a/init/log.c b/init/log.c
index 9564053..83702c6 100644
--- a/init/log.c
+++ b/init/log.c
@@ -175,7 +175,9 @@ void _panic(const char *fileorigin,
/* if we are going to die, we dont really need to clean up */
if(mode == PANICMODE_DIE) {
- kill(-getpgid(pid), SIGKILL);
+ kill(-getpgid(pid), SIGTERM);
+ raise(SIGTERM);
+ exit(0);
}
print(NOLOCK("5") "------------[ cut here ]------------");