summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-04 00:52:40 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-04 00:52:40 +0000
commit3d27c77a63773bae8e8153434769eba7c4925acc (patch)
tree396eb9a0eef4e8113063e11be6a6b1cd0213fb43 /util/nvmutil
parent6e08614e69757475a3b9f8417cc8c7124047d0b9 (diff)
util/nvmutil: reset errno on successful file reads
a non-fatal error could have set errno. when we return from check_read_or_die(), it should be assumed that all is well. i don't think this would mask anything important, but it may be regarded as a preventative bug fix, since it most likely only prevents false-positives. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 46714a23..175683a5 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -432,8 +432,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",