mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 05:36:23 +02:00
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>
This commit is contained in:
@@ -432,8 +432,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