aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-12-27 14:41:30 -0600
committerRob Landley <rob@landley.net>2015-12-27 14:41:30 -0600
commit4b4ab6a50998219cd94139c5669ef9a624c8f58f (patch)
tree3a1e0812da0cfc3c8f8040a381e763531c1026ba /lib/lib.c
parent6769f8eb580aa2ecac4009fcde4a113e0476de74 (diff)
downloadtoybox-4b4ab6a50998219cd94139c5669ef9a624c8f58f.tar.gz
Add scan_key_getsize() doing the ANSI probe, switch scan_key() to TAGGED_ARRAY,
and add test_scankey.
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/lib.c b/lib/lib.c
index a16439e7..5ee7325c 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -516,13 +516,12 @@ void loopfiles_rw(char **argv, int flags, int permissions, int failok,
// Inability to open a file prints a warning, but doesn't exit.
if (!strcmp(*argv, "-")) fd=0;
- else if (0>(fd = open(*argv, flags, permissions)) && !failok) {
+ else if (0>(fd = open(*argv, flags, permissions)) && !failok)
perror_msg("%s", *argv);
- toys.exitval = 1;
- continue;
+ else {
+ function(fd, *argv);
+ if (flags & O_CLOEXEC) close(fd);
}
- function(fd, *argv);
- if (flags & O_CLOEXEC) close(fd);
} while (*++argv);
}