Craig A. Berry [Mon, 30 Oct 2006 00:23:35 +0000 (00:23 +0000)]
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
# 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;