Skip to content

Commit 9e495a0

Browse files
committedMar 21, 2025
unix/monitor-fd: raise explicit SysError rather unreachable
Syscalls can fail for many reasons and we don't want to loose the errno and error context.
1 parent b294629 commit 9e495a0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎src/libutil/unix/monitor-fd.hh

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ public:
5252
;
5353

5454
auto count = poll(fds, 2, -1);
55-
if (count == -1)
56-
unreachable(); // can't happen
55+
if (count == -1) {
56+
if (errno == EINTR || errno == EAGAIN) continue;
57+
throw SysError("failed to poll() in MonitorFdHup");
58+
}
5759
/* This shouldn't happen, but can on macOS due to a bug.
5860
See rdar://37550628.
5961

0 commit comments

Comments
 (0)
Failed to load comments.