diff options
| author | Manuel Stoeckl <code@mstoeckl.com> | 2023-10-07 13:01:22 -0400 |
|---|---|---|
| committer | Kenny Levinsen <kl@kl.wtf> | 2023-10-07 22:15:02 +0200 |
| commit | 0569a47ef78346c1f79506ac1c0d0782febe42cf (patch) | |
| tree | 424120ca4267f1252749d83b3072368d64f9bc4a /main.c | |
| parent | f692ee00757d38022d0f634e6c41072cf4814d1b (diff) | |
Configure SIGUSR1 with sigaction() instead of signal()
If signal() is used to set a signal handler, only the first signal
received will use the handler; any later signals use the default
behavior (making swaylock terminate immediately, without unlocking).
Using sigaction() ensures that the handler will be used every time.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1269,7 +1269,12 @@ int main(int argc, char **argv) { loop_add_fd(state.eventloop, get_comm_reply_fd(), POLLIN, comm_in, NULL); loop_add_fd(state.eventloop, sigusr_fds[0], POLLIN, term_in, NULL); - signal(SIGUSR1, do_sigusr); + + struct sigaction sa; + sa.sa_handler = do_sigusr; + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sigaction(SIGUSR1, &sa, NULL); state.run_display = true; while (state.run_display) { |
