diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2021-03-13 10:42:33 -0600 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2021-03-13 10:42:42 -0600 |
commit | 43b6e804cf4d0e850db72a8a53b8b36130b21435 (patch) | |
tree | 6c9a61c2697f43f0e18a61630d7915956a24aae8 /dwl.c | |
parent | 1fa72b07728ebb396a9f236921b81c369bb12ccb (diff) |
Revert "remove sigchld function"
This reverts commit 1fa72b07728ebb396a9f236921b81c369bb12ccb.
Fixes #97.
Diffstat (limited to 'dwl.c')
-rw-r--r-- | dwl.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -278,6 +278,7 @@ static void setlayout(const Arg *arg); static void setmfact(const Arg *arg); static void setmon(Client *c, Monitor *m, unsigned int newtags); static void setup(void); +static void sigchld(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); @@ -1983,9 +1984,8 @@ setup(void) * clients from the Unix socket, manging Wayland globals, and so on. */ dpy = wl_display_create(); - /* Indicate explicitly to the OS that we are not interested in info - * about child processes (per POSIX.1-2001) */ - signal(SIGCHLD, SIG_IGN); + /* clean up child processes immediately */ + sigchld(0); /* The backend is a wlroots feature which abstracts the underlying input and * output hardware. The autocreate option will choose the most suitable @@ -2137,6 +2137,20 @@ setup(void) } void +sigchld(int unused) +{ + /* We should be able to remove this function in favor of a simple + * signal(SIGCHLD, SIG_IGN); + * but the Xwayland implementation in wlroots currently prevents us from + * setting our own disposition for SIGCHLD. + */ + if (signal(SIGCHLD, sigchld) == SIG_ERR) + EBARF("can't install SIGCHLD handler"); + while (0 < waitpid(-1, NULL, WNOHANG)) + ; +} + +void spawn(const Arg *arg) { if (fork() == 0) { |