git: 494e7dfdbe6e - main - daemon: EINTR from kevent(2) is not a fatal error
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 May 2023 15:29:06 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=494e7dfdbe6ecfe572228ed39f5c794954da068c
commit 494e7dfdbe6ecfe572228ed39f5c794954da068c
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2023-05-05 15:12:13 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2023-05-05 15:28:40 +0000
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;