diff options
author | Craig A. Berry <craigberry@mac.com> | 2006-10-30 00:23:35 +0000 |
---|---|---|
committer | Craig A. Berry <craigberry@mac.com> | 2006-10-30 00:23:35 +0000 |
commit | 085e731f54b0044b320e296e710d73b7205fdf7a (patch) | |
tree | cbdd8f8ed26197dcef4c1d33b34e931b55eb93b1 /perlio.c | |
parent | 667e29483278676092af95a151e7ae7d8eb1d304 (diff) | |
download | perl-085e731f54b0044b320e296e710d73b7205fdf7a.tar.gz |
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
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -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; |