summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-08-26 19:57:08 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-08-26 19:58:01 -0400
commit194e5090d23ea35a046eac37a5d4af6db452bb54 (patch)
tree83facca6ad1ba673cf82bc2cfd7c2b2609758c95 /doio.c
parent131d45a96c910d0fe46597ab156a35837879bf9c (diff)
downloadperl-194e5090d23ea35a046eac37a5d4af6db452bb54.tar.gz
One more FD_CLOEXEC case, missed in 131d45a9.
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/doio.c b/doio.c
index 1b1e951253..d038986c11 100644
--- a/doio.c
+++ b/doio.c
@@ -771,12 +771,10 @@ S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname,
PerlIO_clearerr(fp);
fd = PerlIO_fileno(fp);
}
-#if defined(HAS_FCNTL) && defined(F_SETFD)
- if (fd >= 0) {
- if (fcntl(fd, F_SETFD, fd > PL_maxsysfd) < 0) {
- PerlLIO_close(fd);
- goto say_false;
- }
+#if defined(HAS_FCNTL) && defined(F_SETFD) && defined(FD_CLOEXEC)
+ if (fd > PL_maxsysfd && fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
+ PerlLIO_close(fd);
+ goto say_false;
}
#endif
IoIFP(io) = fp;