Skip to content

Commit 2e62fda

Browse files
committed
use fcntl fallback for additional poll-specific errors
1 parent d3465a8 commit 2e62fda

File tree

1 file changed

+8
-7
lines changed
  • library/std/src/sys/unix

1 file changed

+8
-7
lines changed

library/std/src/sys/unix/mod.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,15 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) {
8888
];
8989

9090
while libc::poll(pfds.as_mut_ptr(), 3, 0) == -1 {
91-
if errno() == libc::EINTR {
92-
continue;
93-
}
94-
if errno() == libc::EINVAL {
95-
// RLIMIT_NOFILE may be preventing use of poll()
96-
break 'poll;
91+
match errno() {
92+
libc::EINTR => continue,
93+
libc::EINVAL | libc::EAGAIN | libc::ENOMEM => {
94+
// RLIMIT_NOFILE or temporary allocation failures
95+
// may be preventing use of poll(), fall back to fcntl
96+
break 'poll;
97+
}
98+
_ => libc::abort(),
9799
}
98-
libc::abort();
99100
}
100101
for pfd in pfds {
101102
if pfd.revents & libc::POLLNVAL == 0 {

0 commit comments

Comments
 (0)