diff options
author | Zefram <zefram@fysh.org> | 2017-12-19 17:11:25 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-22 16:13:26 +0000 |
commit | c297b6b77b7da914f12e3a99a22be9cf449a5b78 (patch) | |
tree | 78442172d7b11faf9b9a5370d28ccab5a29bb64c /perl.c | |
parent | 74df577f6857d2d8543c90e43f90405f92948a61 (diff) | |
download | perl-c297b6b77b7da914f12e3a99a22be9cf449a5b78.tar.gz |
factor out remaining fcntl F_SETFD calls
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -4063,15 +4063,8 @@ 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) && defined(FD_CLOEXEC) - if (fd >= 0) { - /* ensure close-on-exec */ - if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { - Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n", - CopFILE(PL_curcop), Strerror(errno)); - } - } -#endif + if (fd >= 0) + setfd_cloexec(fd); if (fd < 0 || (PerlLIO_fstat(fd, &tmpstatbuf) >= 0 |