Skip to content

Commit bce46e2

Browse files
authored
use_file: remove EAGAIN check (#522)
`poll` can return EAGAIN only on "some other UNIX systems", so we can remove its check for Linux-specific code.
1 parent 869a4f0 commit bce46e2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- Do not read from `errno` when `libc` did not indicate error on Solaris [#448]
2424
- Switch from `libpthread`'s mutex to `futex` on Linux and to `nanosleep`-based wait loop
2525
on other targets in the `use_file` backend [#490]
26+
- Do not retry on `EAGAIN` while polling `/dev/random` on Linux [#522]
2627

2728
### Added
2829
- `wasm32-wasip1` and `wasm32-wasip2` support [#499]
@@ -44,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4445
[#512]: https://github.com/rust-random/getrandom/pull/512
4546
[#520]: https://github.com/rust-random/getrandom/pull/520
4647
[#521]: https://github.com/rust-random/getrandom/pull/521
48+
[#522]: https://github.com/rust-random/getrandom/pull/522
4749

4850
## [0.2.15] - 2024-05-06
4951
### Added

src/use_file.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,10 @@ mod sync {
191191
break Ok(());
192192
}
193193
let err = last_os_error();
194+
// Assuming that `poll` is called correctly,
195+
// on Linux it can return only EINTR and ENOMEM errors.
194196
match err.raw_os_error() {
195-
Some(libc::EINTR) | Some(libc::EAGAIN) => continue,
197+
Some(libc::EINTR) => continue,
196198
_ => break Err(err),
197199
}
198200
};

0 commit comments

Comments
 (0)