summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2022-11-27 09:01:57 +0000
committerLeah Rowe <leah@libreboot.org>2022-11-27 09:01:57 +0000
commit9e5ff5e4e67061c4d53aa7e1973bf3543b7ace3e (patch)
treead44059cc0002aea818450db23c38f9a24188071 /util/nvmutil/nvmutil.c
parentff88cb1ac37eed20e7c9bcf9c36fc17947274abb (diff)
util/nvmutil: move ENOTDIR check to function
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 5081a3e2..925b07e3 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -113,8 +113,6 @@ main(int argc, char *argv[])
errno = EINVAL;
else if (readFromFile(&fd, gbe, FILENAME, flags, SIZE_8KB) != SIZE_8KB)
goto nvmutil_exit;
- else if (errno == ENOTDIR)
- errno = 0;
if (errno != 0)
goto nvmutil_exit;
@@ -172,6 +170,8 @@ readFromFile(int *fd, uint8_t *buf, const char *path, int flags, size_t size)
return -1;
}
}
+ if (errno == ENOTDIR)
+ errno = 0;
return read((*fd), buf, size);
}