util/nvmutil file reads: skip reading if errno!=0

*This condition will probably never be met, but it is theoretically
possible that the code could still fail at this point. Catch all errors,
and exit, ruthlessly.
This commit is contained in:
Leah Rowe
2022-12-08 21:29:36 +00:00
parent 27876c6421
commit 17fa25e5af
+2
View File
@@ -154,6 +154,8 @@ readFromFile(int *fd, uint8_t *buf, const char *path, int flags, size_t size)
if (errno == ENOTDIR)
errno = 0;
else if (errno != 0)
return -1;
return read((*fd), buf, size);
}