From b703bf841e92236c25c1e5b1b6f6245aea83e309 Mon Sep 17 00:00:00 2001 From: guenther Date: Mon, 11 Aug 2014 20:28:47 +0000 Subject: [PATCH] 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@ --- bin/ksh/io.c | 6 ++++-- 1 file 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; } -- 2.20.1