From 494e7dfdbe6ecfe572228ed39f5c794954da068c Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Fri, 5 May 2023 10:12:13 -0500 Subject: [PATCH] daemon: EINTR from kevent(2) is not a fatal error Simply resume waiting for events rather than exiting if we took a signal here. This at least fixes running programs under daemon(8) in the face of suspend/resume, which I suspect hits us with a spurious EINTR rather than a signal anyways. Reported and tested by: manu Fixes: 8935a3993219b ("daemon: use kqueue for all events") --- usr.sbin/daemon/daemon.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 89adde8d5e83..92e640271d10 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -427,6 +427,8 @@ daemon_eventloop(struct daemon_state *state) ret = kevent(kq, NULL, 0, &event, 1, NULL); switch (ret) { case -1: + if (errno == EINTR) + continue; err(EXIT_FAILURE, "kevent wait"); case 0: continue;