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.
This commit is contained in:
Kenny Levinsen 2025-03-13 01:32:32 +01:00
parent 50edd3a42d
commit 954dba3968

View file

@ -36,6 +36,13 @@ noreturn static void exec_xwayland(struct wlr_xwayland_server *server,
_exit(EXIT_FAILURE); _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}; char *argv[64] = {0};
size_t i = 0; size_t i = 0;