This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Always mark pipe in pipe-open as inherit-on-exec
[perl5.git] / util.c
diff --git a/util.c b/util.c
index a9bf9b8..99bf4ae 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2469,8 +2469,10 @@ Perl_my_popen(pTHX_ const char *cmd, const char *mode)
            if (p[THAT] != (*mode == 'r'))      /* if dup2() didn't close it */
                PerlLIO_close(p[THAT]);
        }
-       else
+       else {
+           setfd_cloexec_or_inhexec_by_sysfdness(p[THIS]);
            PerlLIO_close(p[THAT]);
+       }
 #ifndef OS2
        if (doexec) {
 #if !defined(HAS_FCNTL) || !defined(F_SETFD)