From 7be202d1db19581c8420af64b684829ae346f6cf Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 9 Oct 2023 13:36:39 -0400 Subject: Set signal mask and use ppoll --- kitd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'kitd.c') diff --git a/kitd.c b/kitd.c index 2961820..d3dbe3b 100644 --- a/kitd.c +++ b/kitd.c @@ -157,6 +157,10 @@ int main(int argc, char *argv[]) { struct timeval interval = restart; signals[SIGALRM] = 1; + sigset_t mask, unmask; + sigfillset(&mask); + sigemptyset(&unmask); + sigprocmask(SIG_SETMASK, &mask, NULL); struct pollfd fds[2] = { { .fd = stdoutRW[0], .events = POLLIN }, { .fd = stderrRW[0], .events = POLLIN }, @@ -259,7 +263,7 @@ int main(int argc, char *argv[]) { signals[SIGINFO] = 0; } - int nfds = poll(fds, 2, -1); + int nfds = ppoll(fds, 2, NULL, &unmask); if (nfds < 0 && errno != EINTR) { syslog(LOG_ERR, "poll: %m"); continue; -- cgit 1.4.1