util/nvmutil: fix clang build errors

fsdg20230625
Leah Rowe 2023-01-28 14:11:17 +00:00
parent c822033bee
commit a924d43bdd
1 changed files with 6 additions and 7 deletions

View File

@ -120,7 +120,6 @@ main(int argc, char *argv[])
if ((cmd == &cmd_copy) || (cmd == &cmd_swap)) if ((cmd == &cmd_copy) || (cmd == &cmd_swap))
nr = SIZE_4KB; nr = SIZE_4KB;
if ((cmd == &cmd_copy) || (cmd == &cmd_setchecksum) || if ((cmd == &cmd_copy) || (cmd == &cmd_setchecksum) ||
(cmd == &cmd_brick)) (cmd == &cmd_brick))
skipread[part ^ 1] = 1; skipread[part ^ 1] = 1;
@ -131,6 +130,7 @@ main(int argc, char *argv[])
cmd_setmac(strMac); cmd_setmac(strMac);
else if (cmd != NULL) else if (cmd != NULL)
(*cmd)(); (*cmd)();
if (gbeFileModified) if (gbeFileModified)
writeGbeFile(&fd, FILENAME); writeGbeFile(&fd, FILENAME);
@ -148,12 +148,11 @@ readGbeFile(int *fd, const char *path, int flags, size_t nr)
int p, r, tr = 0; int p, r, tr = 0;
if (opendir(path) != NULL) if (opendir(path) != NULL)
err(errno = EISDIR, path); err(errno = EISDIR, "%s", path);
if (((*fd) = open(path, flags)) == -1) if (((*fd) = open(path, flags)) == -1)
err(errno, path); err(errno, "%s", path);
if (fstat((*fd), &st) == -1) if (fstat((*fd), &st) == -1)
err(errno, path); err(errno, "%s", path);
if ((st.st_size != SIZE_8KB)) { if ((st.st_size != SIZE_8KB)) {
fprintf(stderr, "%s: Bad file size (must be 8KiB)\n", path); fprintf(stderr, "%s: Bad file size (must be 8KiB)\n", path);
err(errno = ECANCELED, NULL); err(errno = ECANCELED, NULL);
@ -162,13 +161,13 @@ readGbeFile(int *fd, const char *path, int flags, size_t nr)
if (errno == ENOTDIR) if (errno == ENOTDIR)
errno = 0; errno = 0;
if (errno != 0) if (errno != 0)
err(errno, path); err(errno, "%s", path);
for (p = 0; p < 2; p++) { for (p = 0; p < 2; p++) {
if (skipread[p]) if (skipread[p])
continue; continue;
if ((r = pread((*fd), (uint8_t *) gbe[p], nr, p << 12)) == -1) if ((r = pread((*fd), (uint8_t *) gbe[p], nr, p << 12)) == -1)
err(errno, path); err(errno, "%s", path);
tr += r; tr += r;
} }
printf("%d bytes read from file: `%s`\n", tr, path); printf("%d bytes read from file: `%s`\n", tr, path);