Always mark pipe in list pipe-open as inherit-on-exec
authorLeon Timmermans <fawaka@gmail.com>
Sun, 16 Dec 2018 00:05:06 +0000 (01:05 +0100)
committerLeon Timmermans <fawaka@gmail.com>
Sun, 16 Dec 2018 00:05:06 +0000 (01:05 +0100)
This is the my_popen_list counterpart of
c6fe5b981b942ddabb23ed4b7602067e906e6d88

util.c

diff --git a/util.c b/util.c
index 99bf4ae..8c9909e 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2330,8 +2330,10 @@ Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args)
            if (p[THAT] != (*mode == 'r'))      /* if dup2() didn't close it */
                PerlLIO_close(p[THAT]); /* close parent's end of _the_ pipe */
        }
-       else
+       else {
+           setfd_cloexec_or_inhexec_by_sysfdness(p[THIS]);
            PerlLIO_close(p[THAT]);     /* close parent's end of _the_ pipe */
+        }
 #if !defined(HAS_FCNTL) || !defined(F_SETFD)
        /* No automatic close - do it by hand */
 #  ifndef NOFILE