mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 05:36:23 +02:00
util/nvmutil: tidy up open_dev_urandom
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -357,9 +357,13 @@ open_dev_urandom(void)
|
|||||||
{
|
{
|
||||||
struct stat st_urandom_fd;
|
struct stat st_urandom_fd;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Try /dev/urandom first
|
||||||
|
*/
|
||||||
rname = newrandom;
|
rname = newrandom;
|
||||||
|
if ((urandom_fd = open(rname, O_RDONLY)) != -1)
|
||||||
|
return;
|
||||||
|
|
||||||
if ((urandom_fd = open(rname, O_RDONLY)) == -1) {
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
@@ -372,7 +376,6 @@ open_dev_urandom(void)
|
|||||||
rname = oldrandom;
|
rname = oldrandom;
|
||||||
xopen(&urandom_fd, rname, O_RDONLY, &st_urandom_fd);
|
xopen(&urandom_fd, rname, O_RDONLY, &st_urandom_fd);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user