aboutsummaryrefslogtreecommitdiffstats
path: root/init/init.c
diff options
context:
space:
mode:
authorturret <turret@duck.com>2024-01-11 17:36:37 -0600
committerturret <turret@duck.com>2024-01-11 17:36:37 -0600
commit3ed1e74e16da720dba46d117b12e21b9405ac569 (patch)
treeda91ba432d5a152765a13395a7c3cf1a7bc6a2e2 /init/init.c
parent1b61d9ddc1afdddd429e10eeda90a31ae7e69261 (diff)
downloaddiscord-bot-skeleton-3ed1e74e16da720dba46d117b12e21b9405ac569.tar.gz
discord-bot-skeleton-3ed1e74e16da720dba46d117b12e21b9405ac569.tar.bz2
discord-bot-skeleton-3ed1e74e16da720dba46d117b12e21b9405ac569.zip
init: panic on keyboard interrupt
also: change panic signal to be SIGKILL as sigint being caught would result in a loop
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/init/init.c b/init/init.c
index e82a504..ad1e182 100644
--- a/init/init.c
+++ b/init/init.c
@@ -99,6 +99,7 @@ int main(void)
siginfo_t siginfo;
static sigset_t set;
sigaddset(&set, SIGCHLD);
+ sigaddset(&set, SIGINT);
sigprocmask(SIG_BLOCK, &set, NULL);
while(subsystem_count > 0) {
@@ -113,6 +114,8 @@ int main(void)
if(siginfo.si_status != 0) {
panic("init: process %d exited with non-zero status (%d)", siginfo.si_status);
}
+ } else if(sig == SIGINT) {
+ panic("init: keyboard interrupt");
}
}