util/nvmutil: use err() more consistently

fsdg20230625
lbmkplaceholder 2022-12-24 01:18:17 +00:00
parent d726b16f5f
commit d45b2e70dc
1 changed files with 3 additions and 2 deletions

View File

@ -50,6 +50,7 @@ void setWord(int pos16, int partnum, uint16_t val);
void byteswap(uint8_t *byte); void byteswap(uint8_t *byte);
void writeGbeFile(int *fd, const char *filename); void writeGbeFile(int *fd, const char *filename);
#define PROGNAME argv[0]
#define FILENAME argv[1] #define FILENAME argv[1]
#define COMMAND argv[2] #define COMMAND argv[2]
#define MAC_ADDRESS argv[3] #define MAC_ADDRESS argv[3]
@ -134,7 +135,7 @@ main(int argc, char *argv[])
nvmutil_exit: nvmutil_exit:
if (!((errno == ECANCELED) && (flags == O_RDONLY))) if (!((errno == ECANCELED) && (flags == O_RDONLY)))
if (errno != 0) if (errno != 0)
fprintf(stderr, "%s\n", strerror(errno)); err(errno, NULL);
return errno; return errno;
} }
@ -445,7 +446,7 @@ writeGbeFile(int *fd, const char *filename)
if (close((*fd))) if (close((*fd)))
err(errno, "%s", filename); err(errno, "%s", filename);
if (errno != 0) if (errno != 0)
return; err(errno, "%s", filename);
for (partnum = 0; partnum < 2; partnum++) { for (partnum = 0; partnum < 2; partnum++) {
if (nvmPartModified[partnum]) if (nvmPartModified[partnum])