summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2006-10-30 00:23:35 +0000
committerCraig A. Berry <craigberry@mac.com>2006-10-30 00:23:35 +0000
commit085e731f54b0044b320e296e710d73b7205fdf7a (patch)
treecbdd8f8ed26197dcef4c1d33b34e931b55eb93b1 /perlio.c
parent667e29483278676092af95a151e7ae7d8eb1d304 (diff)
downloadperl-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.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/perlio.c b/perlio.c
index 06a360b9b1..a5d4377350 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;