summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-08-11 20:28:48 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-08-11 20:28:48 +0000
commita24af95bd9bb8e41199abecd5f913f631bdadeb7 (patch)
tree0158a4ed568046bbdfd033ef3b4710247d4ad35c /bin/ksh
parent0fff901638c52ea9631b4d60cd74fe2600e68b87 (diff)
Still need to separately set FD_CLOEXEC if the new fd was >= FDBASE.
Affects scripts that directly use 9 of the first 10 fds. noted by miod@
Diffstat (limited to 'bin/ksh')
-rw-r--r--bin/ksh/io.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/ksh/io.c b/bin/ksh/io.c
index 14f1e6c2fc4..fa4e8016bab 100644
--- a/bin/ksh/io.c
+++ b/bin/ksh/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.24 2014/08/10 02:44:26 guenther Exp $ */
+/* $OpenBSD: io.c,v 1.25 2014/08/11 20:28:47 guenther Exp $ */
/*
* shell buffered IO and formatted output
@@ -244,8 +244,10 @@ savefd(int fd)
else
errorf("too many files open in shell");
}
- } else
+ } else {
nfd = fd;
+ fcntl(nfd, F_SETFD, FD_CLOEXEC);
+ }
return nfd;
}