summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2003-06-02 18:44:34 +0000
committerGurusamy Sarathy <gsar@cpan.org>2003-06-02 18:44:34 +0000
commit3a8ae1affddf8a9aac8746965f2ae13c7af42aba (patch)
treed36a43ec45b7cbc3b84eed59b4d0bfc171cc457d /op.c
parentdc694082e66bcad1c2faeb08a1c5832719339050 (diff)
downloadperl-3a8ae1affddf8a9aac8746965f2ae13c7af42aba.tar.gz
don't use File::Temp to implement PerlIO_tmpfile() on windows;
reuse the straightforward native implementation instead this fixes the warning from io_xs.t NOTE: File::Temp has a less-than-robust implementation on windows that relies on END blocks being run (this may not happen always) p4raw-id: //depot/perl@19667
Diffstat (limited to 'op.c')
-rw-r--r--op.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/op.c b/op.c
index 75adb1747d..cbf19d2798 100644
--- a/op.c
+++ b/op.c
@@ -6511,15 +6511,21 @@ const_sv_xsub(pTHX_ CV* cv)
XSRETURN(1);
}
+/* XXX this belongs in doio.c, not here */
PerlIO*
Perl_my_tmpfp(pTHX)
{
PerlIO *f = NULL;
int fd = -1;
-#ifdef PERL_EXTERNAL_GLOB
+#ifdef WIN32
+ fd = win32_tmpfd();
+ if (fd >= 0)
+ f = PerlIO_fdopen(fd, "w+b");
+#else
+# ifdef PERL_EXTERNAL_GLOB
/* File::Temp pulls in Fcntl, which may not be available with
* e.g. miniperl, use mkstemp() or stdio tmpfile() instead. */
-# if defined(WIN32) || !defined(HAS_MKSTEMP)
+# if defined(WIN32) || !defined(HAS_MKSTEMP)
FILE *stdio = PerlSIO_tmpfile();
if (stdio) {
@@ -6531,7 +6537,7 @@ Perl_my_tmpfp(pTHX)
s->stdio = stdio;
}
}
-# else /* !WIN32 && HAS_MKSTEMP */
+# else /* !WIN32 && HAS_MKSTEMP */
SV *sv = newSVpv("/tmp/PerlIO_XXXXXX", 0);
if (sv) {
@@ -6544,8 +6550,8 @@ Perl_my_tmpfp(pTHX)
}
}
}
-# endif /* WIN32 || !HAS_MKSTEMP */
-#else
+# endif /* !HAS_MKSTEMP */
+# else
/* We have internal glob, which probably also means that we
* can also use File::Temp (which uses Fcntl) with impunity. */
GV *gv = gv_fetchpv("File::Temp::tempfile", FALSE, SVt_PVCV);
@@ -6582,8 +6588,8 @@ Perl_my_tmpfp(pTHX)
FREETMPS;
LEAVE;
}
+# endif
#endif
return f;
}
-