diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2015-08-26 08:55:37 -0400 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2015-08-26 11:40:40 -0400 |
commit | 131d45a96c910d0fe46597ab156a35837879bf9c (patch) | |
tree | 0fca2751032d5ac423fae4e625eab7cce08386ec /perl.c | |
parent | 5798d63101f7b13bd5aaf5a5bf429a8e08991016 (diff) | |
download | perl-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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)); } |