diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-28 08:09:14 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-28 08:09:14 +0000 |
| commit | 49cac232d8e3cc6147a530d4f7971832f6b869b5 (patch) | |
| tree | d8ac4490b6cd9fc1211bc4f1a7416f512a56beec /util/libreboot-utils/lib/rand.c | |
| parent | 03dd3c289439e46ba0c5840cc7ab73b3c3fa60a3 (diff) | |
libreboot-utils: much stricter open() handling
abort on error, and do EINTR looping
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/rand.c')
| -rw-r--r-- | util/libreboot-utils/lib/rand.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c index 99da713c..030ca5ec 100644 --- a/util/libreboot-utils/lib/rand.c +++ b/util/libreboot-utils/lib/rand.c @@ -142,9 +142,7 @@ rset(void *buf, size_t n) #if defined(USE_URANDOM) && \ ((USE_URANDOM) > 0) int fd = -1; - - if ((fd = open("/dev/urandom", O_RDONLY)) < 0) - goto err; + open_on_eintr("/dev/urandom", &fd, O_RDONLY, 0400); retry_rand: if ((rc = read(fd, (unsigned char *)buf + off, n - off)) < 0) { #elif defined(__linux__) |
