reference counts correctly.
p4raw-id: //depot/perl@30633
CODE:
/* Get the FILE* */
stream = PerlIO_findFILE( f );
- RETVAL = xsfclose( stream );
/* Release the FILE* from the PerlIO system so that we do
not close the file twice */
PerlIO_releaseFILE(f,stream);
+ /* Must release the file before closing it */
+ RETVAL = xsfclose( stream );
OUTPUT:
RETVAL
if ((f2 = PerlIO_push(aTHX_ f, PERLIO_FUNCS_CAST(&PerlIO_stdio), buf, NULL))) {
PerlIOStdio *s = PerlIOSelf((f = f2), PerlIOStdio);
s->stdio = stdio;
+ PerlIOUnix_refcnt_inc(fileno(stdio));
/* Link previous lower layers under new one */
*PerlIONext(f) = l;
}
PerlIOStdio *s = PerlIOSelf(&l, PerlIOStdio);
if (s->stdio == f) {
dTHX;
+ const int fd = fileno(f);
+ if (fd >= 0)
+ PerlIOUnix_refcnt_dec(fd);
PerlIO_pop(aTHX_ p);
return;
}