From 5fefbfee64fc0fa1ebe49f92979157ffa2c7c1ae Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sun, 9 Apr 2023 22:08:41 +0200 Subject: [PATCH] cool autostart: restore SIGCHLD sighandler to default before spawning a program --- patch/cool_autostart.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/patch/cool_autostart.c b/patch/cool_autostart.c index ffd4ba3..848f5ab 100644 --- a/patch/cool_autostart.c +++ b/patch/cool_autostart.c @@ -7,6 +7,7 @@ static void autostart_exec() { const char *const *p; + struct sigaction sa; size_t i = 0; /* count entries */ @@ -17,6 +18,13 @@ autostart_exec() for (p = autostart; *p; i++, p++) { if ((autostart_pids[i] = fork()) == 0) { setsid(); + + /* Restore SIGCHLD sighandler to default before spawning a program */ + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + sigaction(SIGCHLD, &sa, NULL); + execvp(*p, (char *const *)p); fprintf(stderr, "dwm: execvp %s\n", *p); perror(" failed");