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>
This commit is contained in:
Leah Rowe
2026-03-04 01:43:39 +00:00
parent 84b4ba48b4
commit d6601059fb
+3 -1
View File
@@ -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",