diff options
author | Leah Rowe <leah@libreboot.org> | 2022-12-07 22:30:55 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2022-12-07 22:30:55 +0000 |
commit | 960af2d6e8d882d958d25333e7cab864877e37b5 (patch) | |
tree | 1d22d5b07725504c2069037c3e0e57fac86d4d3e /util/nvmutil | |
parent | 3d01cf28d618f30e8f1e3670ef0df28da4d29aff (diff) |
util/nvmutil: rhex(): fail if errno not zero
The code was only checking whether all of the bytes were read,
but there are other errors that can be caught via errno.
Enforce strict errno handling, when generating random
numbers for command `setmac`.
Diffstat (limited to 'util/nvmutil')
-rw-r--r-- | util/nvmutil/nvmutil.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 6fb0a1d5..759edea0 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -258,6 +258,8 @@ rhex(void) warn("%s", "/dev/urandom"); return 16; } + if ((errno != 0)) + return 16; } return rbuf[rindex++] & 0xf; |