aboutsummaryrefslogtreecommitdiffstats
path: root/init/subsys.c
diff options
context:
space:
mode:
authorturret <turret@duck.com>2024-01-14 21:15:09 -0600
committerturret <turret@duck.com>2024-01-14 21:15:09 -0600
commitb93f0d9b2ae44ab75d469adf72783030a636b2ea (patch)
treea4da8ba6d039d174ce2416d2b430050e7ceb411a /init/subsys.c
parent4179b6eb0e4434dcac1f6bbf2e78709df964bf77 (diff)
downloaddiscord-bot-skeleton-b93f0d9b2ae44ab75d469adf72783030a636b2ea.tar.gz
discord-bot-skeleton-b93f0d9b2ae44ab75d469adf72783030a636b2ea.tar.bz2
discord-bot-skeleton-b93f0d9b2ae44ab75d469adf72783030a636b2ea.zip
subsys: clear signal handlers
since we moved our signal handlers to be created before subsystems are created, our new signal handlers (which namely blocks SIGTERM, used for panicing) are passed on. in order to restore full panic functionality, we clear all signal blocks before passing execution to the subsystem
Diffstat (limited to 'init/subsys.c')
-rw-r--r--init/subsys.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/init/subsys.c b/init/subsys.c
index 3db2cb5..c3fe903 100644
--- a/init/subsys.c
+++ b/init/subsys.c
@@ -41,6 +41,10 @@ static int __subsystem_entry(struct subsystem_info *info)
prctl(PR_SET_NAME, name);
free(name);
+ /* clear signal handlers so SIGTERM is no longer caught */
+ static sigset_t set;
+ sigprocmask(SIG_SETMASK, &set, NULL);
+
print(LOG_DEBUG "subsys: starting subsystem %s (%d)",
info->fn_name, getpid());