summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perlio.c18
-rw-r--r--win32/perllib.c1
-rw-r--r--win32/win32.c4
3 files changed, 18 insertions, 5 deletions
diff --git a/perlio.c b/perlio.c
index c55b6810aa..865e60e6a5 100644
--- a/perlio.c
+++ b/perlio.c
@@ -943,6 +943,11 @@ PerlIOUnix_oflags(const char *mode)
oflags |= O_WRONLY;
break;
}
+ if (*mode == 'b')
+ {
+ oflags |= O_BINARY;
+ mode++;
+ }
if (*mode || oflags == -1)
{
errno = EINVAL;
@@ -2399,8 +2404,18 @@ PerlIO_stdoutf(const char *fmt,...)
PerlIO *
PerlIO_tmpfile(void)
{
- dTHX;
/* I have no idea how portable mkstemp() is ... */
+#if defined(WIN32) || !defined(HAVE_MKSTEMP)
+ PerlIO *f = NULL;
+ FILE *stdio = tmpfile();
+ if (stdio)
+ {
+ PerlIOStdio *s = PerlIOSelf(PerlIO_push(f = PerlIO_allocate(),&PerlIO_stdio,"w+"),PerlIOStdio);
+ s->stdio = stdio;
+ }
+ return f;
+#else
+ dTHX;
SV *sv = newSVpv("/tmp/PerlIO_XXXXXX",0);
int fd = mkstemp(SvPVX(sv));
PerlIO *f = NULL;
@@ -2415,6 +2430,7 @@ PerlIO_tmpfile(void)
SvREFCNT_dec(sv);
}
return f;
+#endif
}
#undef HAS_FSETPOS
diff --git a/win32/perllib.c b/win32/perllib.c
index e2b245d84f..48843f92da 100644
--- a/win32/perllib.c
+++ b/win32/perllib.c
@@ -371,6 +371,7 @@ DllMain(HANDLE hModule, /* DLL module handle */
* process termination or call to FreeLibrary.
*/
case DLL_PROCESS_DETACH:
+ PerlIO_cleanup();
EndSockets();
#if defined(USE_THREADS) || defined(USE_ITHREADS)
if (PL_curinterp)
diff --git a/win32/win32.c b/win32/win32.c
index f28efa27cb..ed12430497 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2443,11 +2443,7 @@ win32_popen(const char *command, const char *mode)
}
/* we have an fd, return a file stream */
-#ifdef USE_PERLIO
return (PerlIO_fdopen(p[parent], (char *)mode));
-#else
- return (fdopen(p[parent], (char *)mode));
-#endif
cleanup:
/* we don't need to check for errors here */