diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-03 15:43:11 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-03 15:43:11 +0000 |
| commit | 572b7758cf695a526ac2e85aa6f9f0e0c575fde6 (patch) | |
| tree | 9a85b9864f43f2a8af0c2299d54baa14d593d562 /util/nvmutil | |
| parent | 403fd260b5e1a0335e5fc2bfbff081e1c578dcb9 (diff) | |
util/nvmutil: tidy up rhex
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index bcf205c3..73527723 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -340,9 +340,14 @@ hextonum(char ch) static uint8_t rhex(void) { - static uint8_t n = 0, rnum[12]; - if (!n) - err_if(read(rfd, (uint8_t *) &rnum, (n = 11) + 1) == -1); + static uint8_t n = 0; + static uint8_t rnum[12]; + + if (!n) { + n = sizeof(rnum) - 1; + err_if(read(rfd, (uint8_t *) &rnum, n + 1) == -1); + } + return rnum[n--] & 0xf; } |
