From 79c972367e93c42d9a2b14e32bd6e82f5c64de9f Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 6 Mar 2026 23:50:06 +0000 Subject: util/nvmutil: reset errno on /dev/random fallback i didn't catch this before. stale error state would have passed through, even on ultimate success. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index e4fe6c72..1a6f4687 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -358,7 +358,20 @@ open_dev_urandom(void) /* * Fall back to /dev/random on old platforms * where /dev/urandom does not exist. + * + * In general, we can assume that any system + * that would have urandom, probably has the + * other device (/dev/urandom). + * + * Given that on many modern systems, urandom + * and random are essentially the same, this + * also provides some fault-tolerance there, + * while still ultimately being strict under + * fallback conditions, thus: */ + + errno = 0; + rname = oldrandom; xopen(&rfd, rname, O_RDONLY, &st_rfd); } -- cgit v1.2.1