mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 14:02:52 +02:00
lbutils/rand: close fd on urandom error
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -175,11 +175,14 @@ retry_rand: {
|
||||
#error Unsupported operating system (possibly unsecure randomisation)
|
||||
#endif
|
||||
|
||||
if (rc < 0)
|
||||
goto err; /* syscall fehler */
|
||||
|
||||
if (rc == 0)
|
||||
goto err; /* prevent infinite loop on fatal err */
|
||||
if (rc < 0 || /* syscall fehler */
|
||||
rc == 0) { /* prevent infinite loop on fatal err */
|
||||
#if defined(USE_URANDOM) && \
|
||||
((USE_URANDOM) > 0)
|
||||
close_on_eintr(&fd);
|
||||
#endif
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((off += (size_t)rc) < n)
|
||||
goto retry_rand;
|
||||
|
||||
Reference in New Issue
Block a user