From: Craig A. Berry Date: Mon, 30 Oct 2006 00:23:35 +0000 (+0000) Subject: Change the non-mkstemp, non-win32 code path of PerlIO_tmpfile X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=085e731f54b0044b320e296e710d73b7205fdf7a;p=p5sagit%2Fp5-mst-13.2.git Change the non-mkstemp, non-win32 code path of PerlIO_tmpfile to use PerlIO_fdopen so that when the tmpfile is closed we do not decrement a ref count that doesn't exist or is zero. p4raw-id: //depot/perl@29143 --- diff --git a/perlio.c b/perlio.c index 06a360b..a5d4377 100644 --- a/perlio.c +++ b/perlio.c @@ -5090,16 +5090,9 @@ PerlIO_tmpfile(void) # else /* !HAS_MKSTEMP, fallback to stdio tmpfile(). */ FILE * const stdio = PerlSIO_tmpfile(); - if (stdio) { - if ((f = PerlIO_push(aTHX_(PerlIO_allocate(aTHX)), - PERLIO_FUNCS_CAST(&PerlIO_stdio), - "w+", NULL))) { - PerlIOStdio * const s = PerlIOSelf(f, PerlIOStdio); - - if (s) - s->stdio = stdio; - } - } + if (stdio) + f = PerlIO_fdopen(fileno(stdio), "w+"); + # endif /* else HAS_MKSTEMP */ #endif /* else WIN32 */ return f;