summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2022-12-08 21:29:36 +0000
committerLeah Rowe <leah@libreboot.org>2022-12-08 21:29:36 +0000
commit17fa25e5af04b121653bf588b056c1bf49afa104 (patch)
tree53ed02ace3ed8ac380f1e6e4f100799266ca10e6 /util/nvmutil/nvmutil.c
parent27876c6421b5eb1f318688a38698f3c2067131a8 (diff)
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.
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index ef0a71e6..6df68f93 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -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);
}