summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-19 17:11:25 +0000
committerZefram <zefram@fysh.org>2017-12-22 16:13:26 +0000
commitc297b6b77b7da914f12e3a99a22be9cf449a5b78 (patch)
tree78442172d7b11faf9b9a5370d28ccab5a29bb64c /doio.c
parent74df577f6857d2d8543c90e43f90405f92948a61 (diff)
downloadperl-c297b6b77b7da914f12e3a99a22be9cf449a5b78.tar.gz
factor out remaining fcntl F_SETFD calls
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/doio.c b/doio.c
index 160adc596a..56615cdd90 100644
--- a/doio.c
+++ b/doio.c
@@ -1014,12 +1014,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) && defined(FD_CLOEXEC)
- if (fd >= 0 && fd > PL_maxsysfd && fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
- PerlLIO_close(fd);
- goto say_false;
+ if (fd >= 0) {
+ setfd_cloexec(fd);
+ setfd_inhexec_for_sysfd(fd);
}
-#endif
IoIFP(io) = fp;
IoFLAGS(io) &= ~IOf_NOLINE;