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 /toke.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 'toke.c')
-rw-r--r-- | toke.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -7039,10 +7039,12 @@ Perl_yylex(pTHX) if (!GvIO(gv)) GvIOp(gv) = newIO(); IoIFP(GvIOp(gv)) = PL_rsfp; -#if defined(HAS_FCNTL) && defined(F_SETFD) +#if defined(HAS_FCNTL) && defined(F_SETFD) && defined(FD_CLOEXEC) { const int fd = PerlIO_fileno(PL_rsfp); - fcntl(fd,F_SETFD,fd >= 3); + if (fd >= 3) { + fcntl(fd,F_SETFD, FD_CLOEXEC); + } } #endif /* Mark this internal pseudo-handle as clean */ |