util/nvmutil: handle error after check_read_or_die

we already exit reliably in that function. the current code
is logically correct, but very weak against future changes.

this extra check is essentially redundant, but prevantative
against future changes.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-04 01:27:13 +00:00
parent 7d6f1a6b30
commit e28409d80b

View File

@@ -301,6 +301,8 @@ read_gbe_part(int p, int invert)
if (errno)
err(errno, "Unhandled error on read of file '%s'", fname);
if (rval != (ssize_t) SIZE_4KB)
err(ECANCELED, "Unknown error on read of file '%s'", fname);
swap(p ^ invert); /* handle big-endian host CPU */
}
@@ -426,6 +428,8 @@ read_urandom(uint8_t *rnum, size_t rsize)
if (errno)
err(errno, "Unhandled error on read of file '/dev/urandom'");
if (rval != (ssize_t) rsize)
err(ECANCELED, "Unknown error on read of file '/dev/urandom'");
}
static int