From 17fa25e5af04b121653bf588b056c1bf49afa104 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 8 Dec 2022 21:29:36 +0000 Subject: 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. --- util/nvmutil/nvmutil.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util/nvmutil') 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); } -- cgit v1.2.1