Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of multiple SIGUSR1 signals #318

Merged
merged 2 commits into from
Oct 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,11 @@ int main(int argc, char **argv) {

if (pipe(sigusr_fds) != 0) {
swaylock_log(LOG_ERROR, "Failed to pipe");
return 1;
return EXIT_FAILURE;
}
if (fcntl(sigusr_fds[1], F_SETFL, O_NONBLOCK) == -1) {
swaylock_log(LOG_ERROR, "Failed to make pipe end nonblocking");
return EXIT_FAILURE;
}

wl_list_init(&state.surfaces);
Expand Down Expand Up @@ -1269,7 +1273,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);
kennylevinsen marked this conversation as resolved.
Show resolved Hide resolved

state.run_display = true;
while (state.run_display) {
Expand Down