aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/cat.c5
-rw-r--r--toys/posix/chgrp.c3
-rw-r--r--toys/posix/cksum.c5
-rw-r--r--toys/posix/cut.c1
-rw-r--r--toys/posix/df.c1
-rw-r--r--toys/posix/expand.c1
-rw-r--r--toys/posix/head.c5
-rw-r--r--toys/posix/kill.c5
-rw-r--r--toys/posix/mkdir.c7
-rw-r--r--toys/posix/mkfifo.c8
-rw-r--r--toys/posix/rm.c2
-rw-r--r--toys/posix/touch.c5
-rw-r--r--toys/posix/wc.c5
13 files changed, 10 insertions, 43 deletions
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;