util/nvmutil: reset errno on urandom partial read

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-09 15:00:52 +00:00
parent 62964b42ed
commit 2773736dfc
+4 -1
View File
@@ -962,9 +962,11 @@ read_gbe_file_exact(int fd, void *buf, size_t len,
* the smaller amount of bytes and call * the smaller amount of bytes and call
* read_gbe_file_exact again if necessary. * read_gbe_file_exact again if necessary.
*/ */
if (rval > 0) if (rval > 0) {
errno = 0;
return rval; return rval;
} }
}
err(ECANCELED, err(ECANCELED,
"Short %s, %zd bytes, on file: %s", "Short %s, %zd bytes, on file: %s",
@@ -979,6 +981,7 @@ read_gbe_file_exact(int fd, void *buf, size_t len,
err(EINTR, "%s: max retries exceeded on file: %s", err(EINTR, "%s: max retries exceeded on file: %s",
op ? op : "read", path); op ? op : "read", path);
return -1; return -1;
} }