mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-16 23:08:49 +02:00
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:
@@ -436,8 +436,10 @@ static int
|
|||||||
check_read_or_die(const char *rpath, ssize_t rval, size_t rsize,
|
check_read_or_die(const char *rpath, ssize_t rval, size_t rsize,
|
||||||
int retry, const char *readtype)
|
int retry, const char *readtype)
|
||||||
{
|
{
|
||||||
if (rval == (ssize_t) rsize)
|
if (rval == (ssize_t) rsize) {
|
||||||
|
errno = 0;
|
||||||
return 1; /* Successful read */
|
return 1; /* Successful read */
|
||||||
|
}
|
||||||
|
|
||||||
if (rval != -1)
|
if (rval != -1)
|
||||||
err(ECANCELED, "Short %s, %zd bytes, on file: %s",
|
err(ECANCELED, "Short %s, %zd bytes, on file: %s",
|
||||||
|
|||||||
Reference in New Issue
Block a user