diff options
author | Devin J. Pohly <djpohly@gmail.com> | 2022-03-29 15:55:06 -0500 |
---|---|---|
committer | Devin J. Pohly <djpohly@gmail.com> | 2022-03-29 15:55:06 -0500 |
commit | e08bd1292288f662eb265461a8c1a9d7501b0445 (patch) | |
tree | b1ec421a993c05c3f74187f3833b1a93d57e2461 | |
parent | 7018ed9218b05e15d191adcae04167f9d6fc8bce (diff) |
make sure to leave XWayland process waitable
On SIGCHLD, check to make sure the terminated process is not the
XWayland process before reaping it, allowing wlroots to waitpid() for it
successfully.
Fixes #177.
-rw-r--r-- | dwl.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1925,6 +1925,7 @@ setup(void) void sigchld(int unused) { + siginfo_t in; /* 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 @@ -1932,8 +1933,12 @@ sigchld(int unused) */ if (signal(SIGCHLD, sigchld) == SIG_ERR) EBARF("can't install SIGCHLD handler"); - while (0 < waitpid(-1, NULL, WNOHANG)) - ; + /* WNOWAIT leaves the child in a waitable state, in case this is the + * XWayland process + */ + while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid + && in.si_pid != xwayland->server->pid) + waitpid(in.si_pid, NULL, 0); } void |