diff options
| author | The 8472 <git@infinite-source.de> | 2022-06-07 21:30:07 +0200 |
|---|---|---|
| committer | The 8472 <git@infinite-source.de> | 2022-06-10 01:36:50 +0200 |
| commit | 2e62fdab76bd92d0d381589fc85602efad93c846 (patch) | |
| tree | 126b161c1e3061a96db6579d6d93bec3c9cb3555 /library/std/src/sys/unix/mod.rs | |
| parent | d3465a8f210403b922d5796b1f24b536f4defedc (diff) | |
| download | rust-2e62fdab76bd92d0d381589fc85602efad93c846.tar.gz rust-2e62fdab76bd92d0d381589fc85602efad93c846.zip | |
use fcntl fallback for additional poll-specific errors
Diffstat (limited to 'library/std/src/sys/unix/mod.rs')
| -rw-r--r-- | library/std/src/sys/unix/mod.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 0f06811a1d6..852f5dec31a 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -88,14 +88,15 @@ pub unsafe fn init(argc: isize, argv: *const *const u8) { ]; while libc::poll(pfds.as_mut_ptr(), 3, 0) == -1 { - if errno() == libc::EINTR { - continue; - } - if errno() == libc::EINVAL { - // RLIMIT_NOFILE may be preventing use of poll() - break 'poll; + match errno() { + libc::EINTR => continue, + libc::EINVAL | libc::EAGAIN | libc::ENOMEM => { + // RLIMIT_NOFILE or temporary allocation failures + // may be preventing use of poll(), fall back to fcntl + break 'poll; + } + _ => libc::abort(), } - libc::abort(); } for pfd in pfds { if pfd.revents & libc::POLLNVAL == 0 { |
