mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
nvmutil: don't read urandom fd if fd not open
yeah. obvious bug Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -1051,6 +1051,8 @@ rlong(void)
|
||||
if (fd < 0)
|
||||
fd = open("/dev/random", O_RDONLY | O_BINARY | O_NONBLOCK);
|
||||
|
||||
if (fd > -1) {
|
||||
|
||||
nr = rw_file_exact(fd, (unsigned char *)&rval,
|
||||
sizeof(unsigned long), 0, IO_READ, LOOP_EAGAIN,
|
||||
LOOP_EINTR, MAX_ZERO_RW_RETRY, OFF_ERR);
|
||||
@@ -1060,6 +1062,7 @@ rlong(void)
|
||||
|
||||
if (nr == sizeof(unsigned long))
|
||||
return rval;
|
||||
}
|
||||
|
||||
return mix;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user