summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2015-08-26 08:55:37 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2015-08-26 11:40:40 -0400
commit131d45a96c910d0fe46597ab156a35837879bf9c (patch)
tree0fca2751032d5ac423fae4e625eab7cce08386ec /perl.c
parent5798d63101f7b13bd5aaf5a5bf429a8e08991016 (diff)
downloadperl-131d45a96c910d0fe46597ab156a35837879bf9c.tar.gz
Explicitly use and check for FD_CLOEXEC.
This may break places which have the FD_CLOEXEC functionality but do not have the FD_CLOEXEC define. In any case, using a boolean for the F_SETFD flag is icky. Using an explicit 1 is also dubious.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/perl.c b/perl.c
index 303e1f2c5c..64cc3957ff 100644
--- a/perl.c
+++ b/perl.c
@@ -3796,10 +3796,10 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript)
CopFILE(PL_curcop), Strerror(errno));
}
fd = PerlIO_fileno(rsfp);
-#if defined(HAS_FCNTL) && defined(F_SETFD)
+#if defined(HAS_FCNTL) && defined(F_SETFD) && defined(FD_CLOEXEC)
if (fd >= 0) {
/* ensure close-on-exec */
- if (fcntl(fd, F_SETFD, 1) < 0) {
+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) {
Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n",
CopFILE(PL_curcop), Strerror(errno));
}