Change 34616 by [EMAIL PROTECTED] on 2008/10/28 12:39:20

        Integrate:
        [ 34601]
        Integrate:
        [ 34595]
        USE_FAST_STDIO can affect behaviour, so list it in -V
        
        [ 34596]
        Cope with brain damage in PerlIO::via, which will let you fclose() the
        same FILE * twice, thanks to it calling out to Perl space inside the
        close call tree, with the underlying PerlIO * already closed, but not
        unlinked.

Affected files ...

... //depot/maint-5.8/perl/perl.c#236 integrate
... //depot/maint-5.8/perl/perlio.c#123 integrate

Differences ...

==== //depot/maint-5.8/perl/perl.c#236 (text) ====
Index: perl/perl.c
--- perl/perl.c#235~34597~      2008-10-26 12:05:49.000000000 -0700
+++ perl/perl.c 2008-10-28 05:39:20.000000000 -0700
@@ -1944,6 +1944,9 @@
 #  ifdef USE_SITECUSTOMIZE
                             " USE_SITECUSTOMIZE"
 #  endif              
+#  ifdef USE_FAST_STDIO
+                            " USE_FAST_STDIO"
+#  endif              
                                             , 0);
 
                    sv_catpv(opts_prog, PL_bincompat_options);

==== //depot/maint-5.8/perl/perlio.c#123 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#122~34037~    2008-06-09 11:17:41.000000000 -0700
+++ perl/perlio.c       2008-10-28 05:39:20.000000000 -0700
@@ -3125,8 +3125,15 @@
        if (getsockopt(fd, SOL_SOCKET, SO_TYPE, (void *) &optval, &optlen) == 0)
            invalidate = 1;
 #endif
-       if (PerlIOUnix_refcnt_dec(fd) > 0) /* File descriptor still in use */
+       /* Test for -1, as *BSD stdio (at least) on fclose sets the FILE* such
+          that a subsequent fileno() on it returns -1. Don't want to croak()
+          from within PerlIOUnix_refcnt_dec() if some buggy caller code is
+          trying to close an already closed handle which somehow it still has
+          a reference to. (via.xs, I'm looking at you).  */
+       if (fd != -1 && PerlIOUnix_refcnt_dec(fd) > 0) {
+           /* File descriptor still in use */
            invalidate = 1;
+       }
        if (invalidate) {
            /* For STD* handles, don't close stdio, since we shared the FILE *, 
too. */
            if (stdio == stdin) /* Some stdios are buggy fflush-ing inputs */
End of Patch.

Reply via email to