From 954dba3968c2eea3bf2c21defe01bf540fd102f9 Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Thu, 13 Mar 2025 01:32:32 +0100 Subject: [PATCH] xwayland: Reset signal mask and handlers before exec Certain signal-related properties, such as the signal mask and handlers that are set to ignore, are not reset by exec and therefore affect the new process image. In case of Xwayland, a compositor setting SIGCHLD to SIG_IGN causes keyboard compilation to fail as it expects waitpid to work by default. Reset the signal mask and the two signals that sway is known to set. --- xwayland/server.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xwayland/server.c b/xwayland/server.c index 0e8ad44fe..3abeb8bb9 100644 --- a/xwayland/server.c +++ b/xwayland/server.c @@ -36,6 +36,13 @@ noreturn static void exec_xwayland(struct wlr_xwayland_server *server, _exit(EXIT_FAILURE); } + // The compositor may have messed with signal handling, try to clean it up + sigset_t set; + sigemptyset(&set); + sigprocmask(SIG_SETMASK, &set, NULL); + signal(SIGPIPE, SIG_DFL); + signal(SIGCHLD, SIG_DFL); + char *argv[64] = {0}; size_t i = 0;