summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c15
-rw-r--r--win32/win32iop.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c
index b022e0cfc0..083e98e797 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2615,8 +2615,8 @@ win32_rewind(FILE *pf)
return;
}
-DllExport FILE*
-win32_tmpfile(void)
+DllExport int
+win32_tmpfd(void)
{
dTHX;
char prefix[MAX_PATH+1];
@@ -2640,11 +2640,20 @@ win32_tmpfile(void)
#endif
DEBUG_p(PerlIO_printf(Perl_debug_log,
"Created tmpfile=%s\n",filename));
- return fdopen(fd, "w+b");
+ return fd;
}
}
}
}
+ return -1;
+}
+
+DllExport FILE*
+win32_tmpfile(void)
+{
+ int fd = win32_tmpfd();
+ if (fd >= 0)
+ return win32_fdopen(fd, "w+b");
return NULL;
}
diff --git a/win32/win32iop.h b/win32/win32iop.h
index e835b2eea6..1683e97e54 100644
--- a/win32/win32iop.h
+++ b/win32/win32iop.h
@@ -67,6 +67,7 @@ DllExport int win32_fseek(FILE *pf,Off_t offset,int origin);
DllExport int win32_fgetpos(FILE *pf,fpos_t *p);
DllExport int win32_fsetpos(FILE *pf,const fpos_t *p);
DllExport void win32_rewind(FILE *pf);
+DllExport int win32_tmpfd(void);
DllExport FILE* win32_tmpfile(void);
DllExport void win32_abort(void);
DllExport int win32_fstat(int fd,Stat_t *sbufptr);