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 <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-06 23:50:06 +00:00
parent 6e47315192
commit 79c972367e
+13
View File
@@ -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);
}