aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-07-15 04:39:35 -0500
committerRob Landley <rob@landley.net>2016-07-15 04:39:35 -0500
commitfff20ab005ccd98373c5a0675c286e20cf84cbb7 (patch)
treeea3c03bae2963410f585fe7c77035dd3fd0cb368
parentf3b9fd4ec2bdc7f77ecfe52aa9f3e671e325a8e5 (diff)
downloadtoybox-fff20ab005ccd98373c5a0675c286e20cf84cbb7.tar.gz
Don't close stdin when loopfiles reads "-".
-rw-r--r--lib/lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 3f4819fb..09264c95 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -570,7 +570,7 @@ void loopfiles_rw(char **argv, int flags, int permissions, int failok,
continue;
}
function(fd, *argv);
- if (flags & O_CLOEXEC) close(fd);
+ if ((flags & O_CLOEXEC) && fd) close(fd);
} while (*++argv);
}