From d07bee874949ea51facaf41d8e3d71af782bd3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 16 Oct 2024 12:11:33 +0300 Subject: [PATCH 1/2] use_file: remove EAGAIN check --- src/use_file.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/use_file.rs b/src/use_file.rs index 247272dc..a9fceb8a 100644 --- a/src/use_file.rs +++ b/src/use_file.rs @@ -191,8 +191,10 @@ mod sync { break Ok(()); } let err = last_os_error(); + // Assuming that `poll` is called correctly, + // on Linux it can return only EINTR and ENOMEM errors. match err.raw_os_error() { - Some(libc::EINTR) | Some(libc::EAGAIN) => continue, + Some(libc::EINTR) => continue, _ => break Err(err), } }; From cf8a4ea41a87fdcfa207e2ede51e990756d97988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 16 Oct 2024 12:16:30 +0300 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74971dbe..71c8b4e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Do not read from `errno` when `libc` did not indicate error on Solaris [#448] - Switch from `libpthread`'s mutex to `futex` on Linux and to `nanosleep`-based wait loop on other targets in the `use_file` backend [#490] +- Do not retry on `EAGAIN` while polling `/dev/random` on Linux [#522] ### Added - `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 [#512]: https://github.com/rust-random/getrandom/pull/512 [#520]: https://github.com/rust-random/getrandom/pull/520 [#521]: https://github.com/rust-random/getrandom/pull/521 +[#522]: https://github.com/rust-random/getrandom/pull/522 ## [0.2.15] - 2024-05-06 ### Added