Commit 4b4ab6a50998219cd94139c5669ef9a624c8f58f broke loopfiles' handling
of "-". This broke the existing cat tests, so no new test is necessary here.
---
 lib/lib.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
From b31ddddf6495e6b8ea86afaff24424a09ba0a1e9 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Tue, 5 Jan 2016 12:35:56 -0800
Subject: [PATCH] Fix cat -.

Commit 4b4ab6a50998219cd94139c5669ef9a624c8f58f broke loopfiles' handling
of "-". This broke the existing cat tests, so no new test is necessary here.
---
 lib/lib.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/lib.c b/lib/lib.c
index c89aeb6..137552a 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -524,12 +524,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);
-    else {
-      function(fd, *argv);
-      if (flags & O_CLOEXEC) close(fd);
+      continue;
     }
+    function(fd, *argv);
+    if (flags & O_CLOEXEC) close(fd);
   } while (*++argv);
 }
 
-- 
2.6.0.rc2.230.g3dd15c0

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to