summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-06-02 08:28:51 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-06-02 08:28:51 +0000
commitde72a0a2f83a7d3d3d50d7d56d6f442eb3778175 (patch)
treec08fc091c87423011618c590a853d5e943a801b7 /perlio.c
parent7fc811cca11d30db90c233d254557669191be8d8 (diff)
downloadperl-de72a0a2f83a7d3d3d50d7d56d6f442eb3778175.tar.gz
Since pulling in File::Temp for tempfiles would pull in
also Fcntl, miniperl could not open up tempfiles. This broke the use of miniperl in VMS, as noticed by Craig Berry. Try to cure this by moving the creation of tempfile into its own routine, my_tmpfp(), which gets compiled differently for miniperl and perl. p4raw-id: //depot/perl@19656
Diffstat (limited to 'perlio.c')
-rw-r--r--perlio.c46
1 files changed, 3 insertions, 43 deletions
diff --git a/perlio.c b/perlio.c
index ac9887d751..ae3e051959 100644
--- a/perlio.c
+++ b/perlio.c
@@ -4814,42 +4814,10 @@ PerlIO_stdoutf(const char *fmt, ...)
PerlIO *
PerlIO_tmpfile(void)
{
- dTHX;
- PerlIO *f = NULL;
- int fd = -1;
- GV *gv = gv_fetchpv("File::Temp::tempfile", FALSE, SVt_PVCV);
-
- if (!gv) {
- ENTER;
- Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,
- newSVpvn("File::Temp", 10), Nullsv, Nullsv, Nullsv);
- gv = gv_fetchpv("File::Temp::tempfile", FALSE, SVt_PVCV);
- GvIMPORTED_CV_on(gv);
- LEAVE;
- }
+ PerlIO *f = Perl_my_tmpfp();
- if (gv && GvCV(gv)) {
- dSP;
- ENTER;
- SAVETMPS;
- PUSHMARK(SP);
- PUTBACK;
- if (call_sv((SV*)GvCV(gv), G_SCALAR)) {
- GV *gv = (GV*)SvRV(newSVsv(*PL_stack_sp--));
- IO *io = gv ? GvIO(gv) : 0;
- fd = io ? PerlIO_fileno(IoIFP(io)) : -1;
- }
- SPAGAIN;
- PUTBACK;
- FREETMPS;
- LEAVE;
- }
-
- if (fd >= 0) {
- f = PerlIO_fdopen(fd, "w+");
- if (f)
- PerlIOBase(f)->flags |= PERLIO_F_TEMP;
- }
+ if (f)
+ PerlIOBase(f)->flags |= PERLIO_F_TEMP;
return f;
}
@@ -4980,11 +4948,3 @@ PerlIO_sprintf(char *s, int n, const char *fmt, ...)
return result;
}
#endif
-
-
-
-
-
-
-
-