From 49819382e088a19bed610c193947430231d2761d Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 5 Sep 2013 01:11:59 -0700 Subject: [PATCH] util.c:my_pclose: Use NULL in PL_fdpid MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PL_fdpid is an AV, and as of ce0d59f AVs use NULL for nonexist- ent elements. Without using NULL for deleted elements of PL_fdpid, we end up with pipes appearing to be open after they have actually been closed. I don’t know how to write a test for this, but it makes Proc::ParallelLoop pass its tests. --- util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.c b/util.c index a2c2513..d2380b2 100644 --- a/util.c +++ b/util.c @@ -2755,7 +2755,7 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) svp = av_fetch(PL_fdpid,fd,TRUE); pid = (SvTYPE(*svp) == SVt_IV) ? SvIVX(*svp) : -1; SvREFCNT_dec(*svp); - *svp = &PL_sv_undef; + *svp = NULL; #ifdef OS2 if (pid == -1) { /* Opened by popen. */ return my_syspclose(ptr); -- 2.7.4