summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Bergeron <me@bbergeron.xyz>2025-05-17 09:23:41 -0400
committerB. Bergeron <me@bbergeron.xyz>2025-05-17 09:25:29 -0400
commit4730937f2d00844d173cec3bcaa0c0d69c1a4349 (patch)
tree3273a9b5277f6d150fa8596289b32d5b4967000e
parent11bfcf4291bb0b72fd94b8bb69b7fabd3c3fea35 (diff)
Prevent child processes from becoming zombies
Ignoring SIGCHLD causes the system to automatically reap child processes when they terminate, preventing them from becoming zombies.
-rw-r--r--src/sxwm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sxwm.c b/src/sxwm.c
index dd779df..dcf8dbf 100644
--- a/src/sxwm.c
+++ b/src/sxwm.c
@@ -17,6 +17,7 @@
#include <err.h>
#include <stdio.h>
#include <limits.h>
+#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
@@ -1230,6 +1231,8 @@ void setup(void)
evtable[MotionNotify] = hdl_motion;
evtable[PropertyNotify] = hdl_root_property;
scan_existing_windows();
+
+ signal(SIGCHLD, SIG_IGN); /* Prevent child processes from becoming zombies */
}
void setup_atoms(void)