diff options
Diffstat (limited to 'disk-utils/mkfs.cramfs.c')
| -rw-r--r-- | disk-utils/mkfs.cramfs.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c index b5edb7a4b..ebc8112e2 100644 --- a/disk-utils/mkfs.cramfs.c +++ b/disk-utils/mkfs.cramfs.c @@ -161,14 +161,13 @@ do_mmap(char *path, unsigned int size, unsigned int mode){ fd = open(path, O_RDONLY); if (fd < 0) { - warn(_("open failed: %s"), path); + warn(_("cannot open %s"), path); warn_skip = 1; goto err; } start = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); if (-1 == (int) (long) start) { - free(start); close(fd); err(MKFS_EX_ERROR, "mmap"); } @@ -736,7 +735,7 @@ int main(int argc, char **argv) opt_errors = 1; break; case 'e': - opt_edition = strtou32_or_err(optarg, _("edition number argument failed")); + opt_edition = strtou32_or_err(optarg, _("invalid edition number argument")); break; case 'N': if (strcmp(optarg, "big") == 0) @@ -746,8 +745,8 @@ int main(int argc, char **argv) else if (strcmp(optarg, "host") == 0) /* default */ ; else - errx(MKFS_EX_USAGE, _("invalid endianness given." - " Must be 'big', 'little', or 'host'")); + errx(MKFS_EX_USAGE, _("invalid endianness given;" + " must be 'big', 'little', or 'host'")); break; case 'i': opt_image = optarg; @@ -879,12 +878,11 @@ int main(int argc, char **argv) (long long) fslen_ub, offset); written = write(fd, rom_image, offset); - close(fd); - if (written < 0) - err(MKFS_EX_ERROR, _("ROM image")); if (offset != written) errx(MKFS_EX_ERROR, _("ROM image write failed (%zd %zd)"), written, offset); + if (close_fd(fd) != 0) + err(MKFS_EX_ERROR, _("ROM image")); /* * (These warnings used to come at the start, but they scroll off |
