summaryrefslogtreecommitdiff
path: root/comm.c
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2025-04-27 18:17:21 +0200
committerSimon Ser <contact@emersion.fr>2025-04-27 18:30:04 +0200
commitae8011a3548f32980af9e915189b1d48f019f77f (patch)
tree95a64565c380a7d1b37f6e9a97f8e7253512563c /comm.c
parenta1cf39ab0ff0687994a66ba116b316bc59849e2c (diff)
Ignore SIGUSR1 in the backend child process
If a user calls `killall -USR1 swaylock`, they may end up signalling the password backend. As the password backend forked before SIGUSR1 handling was set up, it inherits the default handler and terminates. Set the SIGUSR1 handler to SIG_IGN in the child process. Fixes: https://github.com/swaywm/swaylock/issues/409
Diffstat (limited to 'comm.c')
-rw-r--r--comm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/comm.c b/comm.c
index 4955b1d..1e5fd49 100644
--- a/comm.c
+++ b/comm.c
@@ -96,6 +96,10 @@ bool spawn_comm_child(void) {
swaylock_log_errno(LOG_ERROR, "failed to fork");
return false;
} else if (child == 0) {
+ struct sigaction sa = {
+ .sa_handler = SIG_IGN,
+ };
+ sigaction(SIGUSR1, &sa, NULL);
close(comm[0][1]);
close(comm[1][0]);
run_pw_backend_child();