diff options
author | Rob Landley <rob@landley.net> | 2016-09-05 00:55:24 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-09-05 00:55:24 -0500 |
commit | eed9ed41aa73023af8f79cd5353b96b80585490f (patch) | |
tree | 9b1a36022b0748b06224c48239d0c0e2ebbefddc /toys/posix/cmp.c | |
parent | 7f7907f53ecaeabb00929feb0ede85a456683ddc (diff) | |
download | toybox-eed9ed41aa73023af8f79cd5353b96b80585490f.tar.gz |
Replace loopfiles' failok with WARN_ONLY open flag.
Diffstat (limited to 'toys/posix/cmp.c')
-rw-r--r-- | toys/posix/cmp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/toys/posix/cmp.c b/toys/posix/cmp.c index 527fbfda..f4c34091 100644 --- a/toys/posix/cmp.c +++ b/toys/posix/cmp.c @@ -43,6 +43,8 @@ static void do_cmp(int fd, char *name) return; } + toys.exitval = 0; + for (;;) { len1 = readall(TT.fd, toybuf, size); len2 = readall(fd, buf2, size); @@ -54,11 +56,9 @@ static void do_cmp(int fd, char *name) if (toys.optflags & FLAG_l) printf("%ld %o %o\n", byte_no, toybuf[i], buf2[i]); else { - if (!(toys.optflags & FLAG_s)) { + if (!(toys.optflags & FLAG_s)) printf("%s %s differ: char %ld, line %ld\n", TT.name, name, byte_no, line_no); - toys.exitval++; - } goto out; } } @@ -79,6 +79,8 @@ out: void cmp_main(void) { - loopfiles_rw(toys.optargs, O_CLOEXEC, 0, toys.optflags&FLAG_s, do_cmp); + toys.exitval = 2; + loopfiles_rw(toys.optargs, O_CLOEXEC|(WARN_ONLY*!(toys.optflags&FLAG_s)), 0, + do_cmp); } |