summaryrefslogtreecommitdiff
path: root/util/nvmutil/nvmutil.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2022-11-27 09:34:20 +0000
committerLeah Rowe <leah@libreboot.org>2022-11-27 09:36:18 +0000
commit342e5abe5e46cf6e45fb4fb75a057b660abb978d (patch)
tree71c1329afb2b4415205cf0158019d4ad78836c16 /util/nvmutil/nvmutil.c
parentd7465efbb0c5676f5dbe464773155cbe6a51dc2d (diff)
util/nvmutil: improved errno handling in main
Diffstat (limited to 'util/nvmutil/nvmutil.c')
-rw-r--r--util/nvmutil/nvmutil.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index a5173a81..a9ed5c80 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -113,15 +113,15 @@ main(int argc, char *argv[])
else if (readFromFile(&fd, gbe, FILENAME, flags, SIZE_8KB) != SIZE_8KB)
goto nvmutil_exit;
- if (errno != 0)
- goto nvmutil_exit;
- else if (strMac != NULL)
- setmac(strMac);
- else if (cmd != NULL)
- (*cmd)();
-
- if (gbeFileModified)
- writeGbeFile(&fd, FILENAME);
+ if (errno == 0) {
+ if (strMac != NULL)
+ setmac(strMac);
+ else if (cmd != NULL)
+ (*cmd)();
+
+ if (gbeFileModified)
+ writeGbeFile(&fd, FILENAME);
+ }
nvmutil_exit:
if (!((errno == ECANCELED) && (flags == O_RDONLY)))