summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/dwl.c b/dwl.c
index 3f66be4..a14dc5c 100644
--- a/dwl.c
+++ b/dwl.c
@@ -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