mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-18 23:24:11 +02:00
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:
@@ -358,7 +358,20 @@ open_dev_urandom(void)
|
|||||||
/*
|
/*
|
||||||
* Fall back to /dev/random on old platforms
|
* Fall back to /dev/random on old platforms
|
||||||
* where /dev/urandom does not exist.
|
* 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;
|
rname = oldrandom;
|
||||||
xopen(&rfd, rname, O_RDONLY, &st_rfd);
|
xopen(&rfd, rname, O_RDONLY, &st_rfd);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user