aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGenki Sky <sky@genki.is>2018-07-22 22:00:10 -0400
committerDrew DeVault <sir@cmpwn.com>2018-07-24 08:22:35 -0400
commitb6ed1f29a4dbba93eb53c32ec5492db8ee1d9343 (patch)
tree3b72fd82bb32ac3916e9178390c32e68687a52ba
parent2297797bf9a6db774a3ed7909fb37f8789e1f786 (diff)
rootston: Reap child processes
Just install a SIG_IGN handler, which is defined by POSIX.1-2001 to reap the child. To test, spawn any process (e.g. GUI application) with a keybinding, close that process, verify it doesn't show up as a <defunct> zombie in ps(1) output.
-rw-r--r--rootston/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/rootston/main.c b/rootston/main.c
index cc3ffd3e..6f4e2612 100644
--- a/rootston/main.c
+++ b/rootston/main.c
@@ -1,5 +1,6 @@
#define _POSIX_C_SOURCE 200112L
#include <assert.h>
+#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <wayland-server.h>
@@ -15,6 +16,11 @@
struct roots_server server = { 0 };
int main(int argc, char **argv) {
+ if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
+ wlr_log_errno(WLR_ERROR, "Unable to install SIGCHLD handler");
+ return 1;
+ }
+
wlr_log_init(WLR_DEBUG, NULL);
server.config = roots_config_create_from_args(argc, argv);
server.wl_display = wl_display_create();