util/nvmutil: improved errno handling in main

fsdg20230625
Leah Rowe 2022-11-27 09:34:20 +00:00
parent d7465efbb0
commit 342e5abe5e
1 changed files with 8 additions and 8 deletions

View File

@ -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)
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)))