From 631e5be0d7a7e4c7086b9778bc8fac809f96d336 Mon Sep 17 00:00:00 2001 From: Tycho Andersen Date: Wed, 27 Nov 2024 08:16:16 -0700 Subject: [PATCH] xwayland: don't fail on SIGCHLD SIGCHLD here isn't fatal: we have other means of notifying that things were successful or failure, and it causes many compositors to have to do a bunch of extra work: https://github.com/qtile/qtile/issues/5101 https://github.com/flacjacket/pywlroots/pull/207#issuecomment-2502680133 https://github.com/djpohly/dwl/pull/212 Signed-off-by: Tycho Andersen --- xwayland/server.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xwayland/server.c b/xwayland/server.c index 4f92879d1..0f3956fcb 100644 --- a/xwayland/server.c +++ b/xwayland/server.c @@ -257,6 +257,17 @@ static int xserver_handle_ready(int fd, uint32_t mask, void *data) { if (errno == EINTR) { continue; } + + /* If some application has installed a SIGCHLD handler, they + * may race and waitpid() on our child, which will cause this + * waitpid() to fail. We have a signal from the + * notify pipe that things are ready, so this waitpid() is only + * to prevent zombies, which will have already been reaped by + * the application's SIGCHLD handler. + */ + if (errno == ECHILD) { + break; + } wlr_log_errno(WLR_ERROR, "waitpid for Xwayland fork failed"); goto error; }