diff --git a/main.c b/main.c index 61a89f1..f8a8453 100644 --- a/main.c +++ b/main.c @@ -279,11 +279,6 @@ main(int argc, char *const *argv) sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); - sigset_t proc_signal_mask; - sigemptyset(&proc_signal_mask); - sigaddset(&proc_signal_mask, SIGCHLD); - sigprocmask(SIG_BLOCK, &proc_signal_mask, NULL); - /* Block SIGINT (this is under the assumption that threads inherit * the signal mask */ sigset_t signal_mask; @@ -341,15 +336,17 @@ main(int argc, char *const *argv) while (!aborted) { struct pollfd fds[] = {{.fd = abort_fd, .events = POLLIN}}; - int r __attribute__((unused)) = poll(fds, 1, -1); + int r __attribute__((unused)) = poll(fds, sizeof(fds) / sizeof(fds[0]), -1); - /* - * Either the bar aborted (triggering the abort_fd), or user - * killed us (triggering the signal handler which sets - * 'aborted') - */ - assert(aborted || r == 1); - break; + if (fds[0].revents & (POLLIN | POLLHUP)) { + /* + * Either the bar aborted (triggering the abort_fd), or user + * killed us (triggering the signal handler which sets + * 'aborted') + */ + assert(aborted || r == 1); + break; + } } if (aborted)