diff options
author | Rob Landley <rob@landley.net> | 2013-01-02 02:00:35 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2013-01-02 02:00:35 -0600 |
commit | 662a267c9b52f256b027d0f176a846b1d973ab99 (patch) | |
tree | 1ff58749c737a283a199e1e567894fe16a9d0ce5 /toys/other | |
parent | 090c5c607ec682e5cfc03bbc745cd1ed28d5d6ce (diff) | |
download | toybox-662a267c9b52f256b027d0f176a846b1d973ab99.tar.gz |
Have error_msg() and friends set TT.exitval to 1 if it's still 0, clean out other places that were setting it that no longer need to.
Diffstat (limited to 'toys/other')
-rw-r--r-- | toys/other/dos2unix.c | 5 | ||||
-rw-r--r-- | toys/other/losetup.c | 5 | ||||
-rw-r--r-- | toys/other/realpath.c | 6 | ||||
-rw-r--r-- | toys/other/truncate.c | 5 |
4 files changed, 5 insertions, 16 deletions
diff --git a/toys/other/dos2unix.c b/toys/other/dos2unix.c index 59cd6a53..3e1feb0e 100644 --- a/toys/other/dos2unix.c +++ b/toys/other/dos2unix.c @@ -33,10 +33,7 @@ static void do_dos2unix(int fd, char *name) int len, in, out; len = read(fd, toybuf+(sizeof(toybuf)/2), sizeof(toybuf)/2); - if (len<0) { - perror_msg("%s",name); - toys.exitval = 1; - } + if (len<0) perror_msg("%s",name); if (len<1) break; for (in = out = 0; in < len; in++) { diff --git a/toys/other/losetup.c b/toys/other/losetup.c index aa62222c..b455f355 100644 --- a/toys/other/losetup.c +++ b/toys/other/losetup.c @@ -61,7 +61,7 @@ todo: basic /dev file association static void loopback_setup(char *device, char *file) { struct loop_info64 *loop = (void *)(toybuf+32); - int rc = 0, lfd = -1, ffd; + int lfd = -1, ffd; unsigned flags = toys.optflags; // Open file (ffd) and loop device (lfd) @@ -89,7 +89,6 @@ static void loopback_setup(char *device, char *file) if (errno == ENXIO && (flags & (FLAG_a|FLAG_j))) return; if (errno != ENXIO || !file) { perror_msg("%s", device ? device : "-f"); - rc = 1; goto done; } } @@ -102,7 +101,6 @@ static void loopback_setup(char *device, char *file) if (flags & (FLAG_c|FLAG_d)) { if (ioctl(lfd, (flags & FLAG_c) ? LOOP_SET_CAPACITY : LOOP_CLR_FD, 0)) { perror_msg("%s", device); - rc = 1; goto done; } // Associate file with this device? @@ -129,7 +127,6 @@ static void loopback_setup(char *device, char *file) done: if (file) close(ffd); if (lfd != -1) close(lfd); - toys.exitval |= rc; } // Perform an action on all currently existing loop devices diff --git a/toys/other/realpath.c b/toys/other/realpath.c index dc75840b..ec981082 100644 --- a/toys/other/realpath.c +++ b/toys/other/realpath.c @@ -20,9 +20,7 @@ void realpath_main(void) char **s = toys.optargs; for (s = toys.optargs; *s; s++) { - if (!realpath(*s, toybuf)) { - perror_msg("cannot access '%s'", *s); - toys.exitval = 1; - } else xputs(toybuf); + if (!realpath(*s, toybuf)) perror_msg("%s", *s); + else xputs(toybuf); } } diff --git a/toys/other/truncate.c b/toys/other/truncate.c index 5ed9f61b..123ae553 100644 --- a/toys/other/truncate.c +++ b/toys/other/truncate.c @@ -26,10 +26,7 @@ GLOBALS( static void do_truncate(int fd, char *name) { if (fd<0) return; - if (ftruncate(fd, TT.size)) { - perror_msg("failed to set '%s' to '%ld'", name, TT.size); - toys.exitval = EXIT_FAILURE; - } + if (ftruncate(fd, TT.size)) perror_msg("'%s' to '%ld'", name, TT.size); } void truncate_main(void) |