diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-04 01:43:39 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-04 01:43:39 +0000 |
| commit | d6601059fbe8d00065bf0e4fffeaf597642469ca (patch) | |
| tree | 0bc097972f1cb05c11c37f00130c282f376119b4 | |
| parent | 84b4ba48b42279b434633596d899ad8f1dcbc0ab (diff) | |
util/nvmutil: reset errno on *successful* read
otherwise, stale errno from an earlier syscall might
cause a valid read to still fail.
Signed-off-by: Leah Rowe <leah@libreboot.org>
| -rw-r--r-- | util/nvmutil/nvmutil.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 749ed0bc..6ed6d946 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -436,8 +436,10 @@ static int check_read_or_die(const char *rpath, ssize_t rval, size_t rsize, int retry, const char *readtype) { - if (rval == (ssize_t) rsize) + if (rval == (ssize_t) rsize) { + errno = 0; return 1; /* Successful read */ + } if (rval != -1) err(ECANCELED, "Short %s, %zd bytes, on file: %s", |
