diff options
author | Leah Rowe <leah@libreboot.org> | 2023-06-01 11:56:01 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-06-01 12:02:16 +0100 |
commit | 18f39ab6fafde132af48350d7c976afa5716038f (patch) | |
tree | 326e4626e92bbf3dbbb51df9f56de6a73913fa3d /util/nvmutil/nvmutil.c | |
parent | 4d91bcc2d75ba9874ed352ef0fde5cfa128c4ebd (diff) |
util/nvmutil: clean up rhex()
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r-- | util/nvmutil/nvmutil.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index d047e2aa..fcdab9e8 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -140,10 +140,9 @@ rhex(void) { static int rfd = -1, n = 0; static uint8_t rnum[16]; - if (!n) { - xopen(rfd, "/dev/urandom", O_RDONLY); + xopen(rfd, "/dev/urandom", O_RDONLY); + if (!n) xpread(rfd, (uint8_t *) &rnum, (n = 15) + 1, 0, "/dev/urandom"); - } return rnum[n--] & 0xf; } |