about summary refs log tree commit diff
path: root/kitd.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2023-10-09 13:36:39 -0400
committerJune McEnroe <june@causal.agency>2023-10-09 13:36:39 -0400
commit7be202d1db19581c8420af64b684829ae346f6cf (patch)
treeebb8171ff97c3de7efc4f626f774ee8f3351145f /kitd.c
parentUse setitimer(2) (diff)
downloadkitd-7be202d1db19581c8420af64b684829ae346f6cf.tar.gz
kitd-7be202d1db19581c8420af64b684829ae346f6cf.zip
Set signal mask and use ppoll
Diffstat (limited to 'kitd.c')
-rw-r--r--kitd.c6
1 files changed, 5 insertions, 1 deletions
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;