diff options
Diffstat (limited to 'toys')
-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 | ||||
-rw-r--r-- | toys/posix/cat.c | 5 | ||||
-rw-r--r-- | toys/posix/chgrp.c | 3 | ||||
-rw-r--r-- | toys/posix/cksum.c | 5 | ||||
-rw-r--r-- | toys/posix/cut.c | 1 | ||||
-rw-r--r-- | toys/posix/df.c | 1 | ||||
-rw-r--r-- | toys/posix/expand.c | 1 | ||||
-rw-r--r-- | toys/posix/head.c | 5 | ||||
-rw-r--r-- | toys/posix/kill.c | 5 | ||||
-rw-r--r-- | toys/posix/mkdir.c | 7 | ||||
-rw-r--r-- | toys/posix/mkfifo.c | 8 | ||||
-rw-r--r-- | toys/posix/rm.c | 2 | ||||
-rw-r--r-- | toys/posix/touch.c | 5 | ||||
-rw-r--r-- | toys/posix/wc.c | 5 |
17 files changed, 15 insertions, 59 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) diff --git a/toys/posix/cat.c b/toys/posix/cat.c index 431c7751..78881c4c 100644 --- a/toys/posix/cat.c +++ b/toys/posix/cat.c @@ -25,10 +25,7 @@ static void do_cat(int fd, char *name) for (;;) { len = read(fd, toybuf, size); - if (len<0) { - perror_msg("%s",name); - toys.exitval = EXIT_FAILURE; - } + if (len<0) perror_msg("%s",name); if (len<1) break; xwrite(1, toybuf, len); } diff --git a/toys/posix/chgrp.c b/toys/posix/chgrp.c index 6e1e16f0..e416f27f 100644 --- a/toys/posix/chgrp.c +++ b/toys/posix/chgrp.c @@ -60,8 +60,7 @@ static int do_chgrp(struct dirtree *node) toys.which->name[2]=='o' && TT.group_name ? ":" : "", TT.group_name ? TT.group_name : "", path); if (ret == -1 && !(toys.optflags & FLAG_f)) - perror_msg("changing owner:group of '%s' to '%s:%s'", path, - TT.owner_name, TT.group_name); + perror_msg("'%s' to '%s:%s'", path, TT.owner_name, TT.group_name); free(path); } toys.exitval |= ret; diff --git a/toys/posix/cksum.c b/toys/posix/cksum.c index 1192077c..9f6aa42b 100644 --- a/toys/posix/cksum.c +++ b/toys/posix/cksum.c @@ -51,10 +51,7 @@ static void do_cksum(int fd, char *name) int len, i; len = read(fd, toybuf, sizeof(toybuf)); - if (len<0) { - perror_msg("%s",name); - toys.exitval = EXIT_FAILURE; - } + if (len<0) perror_msg("%s", name); if (len<1) break; llen += len; diff --git a/toys/posix/cut.c b/toys/posix/cut.c index af4a1d9a..6f813102 100644 --- a/toys/posix/cut.c +++ b/toys/posix/cut.c @@ -127,7 +127,6 @@ static void get_data(void) int fd = open(*argv, O_RDONLY, 0); if(fd < 0) {//if file not present then continue with other files. perror_msg(*argv); - toys.exitval = EXIT_FAILURE; continue; } do_cut(fd); diff --git a/toys/posix/df.c b/toys/posix/df.c index 5641ff34..957e80b2 100644 --- a/toys/posix/df.c +++ b/toys/posix/df.c @@ -120,7 +120,6 @@ void df_main(void) // Stat it (complain if we can't). if(stat(*next, &st)) { perror_msg("`%s'", *next); - toys.exitval = 1; continue; } diff --git a/toys/posix/expand.c b/toys/posix/expand.c index 789364bb..7bc37169 100644 --- a/toys/posix/expand.c +++ b/toys/posix/expand.c @@ -39,7 +39,6 @@ static void expand_file(int fd, char *name) len = read(fd, toybuf, sizeof(toybuf)); if (len<0) { perror_msg("%s", name); - toys.exitval = 1; return; } if (!len) break; diff --git a/toys/posix/head.c b/toys/posix/head.c index ba7b7385..e8517d44 100644 --- a/toys/posix/head.c +++ b/toys/posix/head.c @@ -39,10 +39,7 @@ static void do_head(int fd, char *name) while (lines) { len = read(fd, toybuf, size); - if (len<0) { - perror_msg("%s",name); - toys.exitval = EXIT_FAILURE; - } + if (len<0) perror_msg("%s",name); if (len<1) break; for(i=0; i<len;) if (toybuf[i++] == '\n' && !--lines) break; diff --git a/toys/posix/kill.c b/toys/posix/kill.c index 2d1606b4..1e5e1d9f 100644 --- a/toys/posix/kill.c +++ b/toys/posix/kill.c @@ -62,9 +62,6 @@ void kill_main(void) char *arg = *(args++); pid = strtol(arg, &tmp, 10); - if (*tmp || kill(pid, signum) < 0) { - error_msg("unknown pid '%s'", arg); - toys.exitval = EXIT_FAILURE; - } + if (*tmp || kill(pid, signum) < 0) error_msg("unknown pid '%s'", arg); } } diff --git a/toys/posix/mkdir.c b/toys/posix/mkdir.c index a523fd59..24930f4a 100644 --- a/toys/posix/mkdir.c +++ b/toys/posix/mkdir.c @@ -69,10 +69,5 @@ void mkdir_main(void) if(toys.optflags&FLAG_m) TT.mode = string_to_mode(TT.arg_mode, 0777); - for (s=toys.optargs; *s; s++) { - if (do_mkdir(*s)) { - perror_msg("'%s'", *s); - toys.exitval = 1; - } - } + for (s=toys.optargs; *s; s++) if (do_mkdir(*s)) perror_msg("'%s'", *s); } diff --git a/toys/posix/mkfifo.c b/toys/posix/mkfifo.c index 322c0bd2..15fab70a 100644 --- a/toys/posix/mkfifo.c +++ b/toys/posix/mkfifo.c @@ -30,10 +30,6 @@ void mkfifo_main(void) TT.mode = 0666; if (toys.optflags & FLAG_m) TT.mode = string_to_mode(TT.m_string, 0); - for (s = toys.optargs; *s; s++) { - if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) { - perror_msg("cannot create fifo '%s'", *s); - toys.exitval = 1; - } - } + for (s = toys.optargs; *s; s++) + if (mknod(*s, S_IFIFO | TT.mode, 0) < 0) perror_msg("%s", *s); } diff --git a/toys/posix/rm.c b/toys/posix/rm.c index c9f741ca..7954daec 100644 --- a/toys/posix/rm.c +++ b/toys/posix/rm.c @@ -64,7 +64,6 @@ static int do_rm(struct dirtree *try) skip: if (unlinkat(fd, try->name, using)) { perror_msg("%s", try->name); - toys.exitval = 1; nodelete: if (try->parent) try->parent->symlink = (char *)1; } @@ -82,7 +81,6 @@ void rm_main(void) for (s = toys.optargs; *s; s++) { if (!strcmp(*s, "/")) { error_msg("rm /. if you mean it"); - toys.exitval = 1; continue; } diff --git a/toys/posix/touch.c b/toys/posix/touch.c index e350e754..76884be2 100644 --- a/toys/posix/touch.c +++ b/toys/posix/touch.c @@ -116,9 +116,6 @@ void touch_main(void) if ((!flag || !fetch(*ss, tv, flag)) && !utimes(*ss, tv)) ss++; else if (toys.optflags & FLAG_c) ss++; else if (-1 != (fd = open(*ss, O_CREAT, 0666))) close(fd); - else { - perror_msg("'%s'", *ss++); - toys.exitval = 1; - } + else perror_msg("'%s'", *ss++); } } diff --git a/toys/posix/wc.c b/toys/posix/wc.c index 56c9673a..3a6540b1 100644 --- a/toys/posix/wc.c +++ b/toys/posix/wc.c @@ -52,10 +52,7 @@ static void do_wc(int fd, char *name) for (;;) { len = read(fd, toybuf, sizeof(toybuf)); - if (len<0) { - perror_msg("%s",name); - toys.exitval = 1; - } + if (len<0) perror_msg("%s", name); if (len<1) break; for (i=0; i<len; i+=clen) { wchar_t wchar; |