summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index b1469586..4f229b1f 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -219,13 +219,15 @@ readGbe(void)
ssize_t nr = pread(fd, (uint8_t *) gbe[p], nf, p * partsize);
err_if(nr == -1);
- if (nr != nf)
- err(errno == ECANCELED,
- "%ld bytes read from '%s', expected %ld bytes\n",
- nr, filename, nf);
+ if (nr == nf) {
+ tnr += nr;
+ swap(p); /* handle big-endian host CPU */
+ continue;
+ }
- tnr += nr;
- swap(p); /* handle big-endian host CPU */
+ err(errno == ECANCELED,
+ "%ld bytes read from '%s' part %d, expected %ld bytes\n",
+ nr, filename, p, nf);
}
printf("%ld bytes read from file '%s'\n", tnr, filename);
@@ -431,12 +433,14 @@ writeGbe(void)
swap(p); /* swap bytes on big-endian host CPUs */
ssize_t nw = pwrite(fd, (uint8_t *) gbe[p], nf, p * partsize);
err_if(nw == -1);
- if (nw != nf)
- err(errno == ECANCELED,
- "%ld bytes written to '%s', expected %ld bytes\n",
- nw, filename, nf);
+ if (nw == nf) {
+ tnw += nf;
+ continue;
+ }
- tnw += nf;
+ err(errno == ECANCELED,
+ "%ld bytes written to '%s' part %d, expected %ld bytes\n",
+ nw, filename, p, nf);
}
if ((flags != O_RDONLY) && (cmd != cmd_dump)) {