summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perlio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/perlio.c b/perlio.c
index 5d41e76c55..ec19bfe453 100644
--- a/perlio.c
+++ b/perlio.c
@@ -4971,6 +4971,12 @@ PerlIO_tmpfile(void)
/* else we try /tmp */
fd = mkstemp(tempname);
}
+ if (fd < 0) {
+ /* Try cwd */
+ sv = newSVpvs(".");
+ sv_catpv(sv, tempname + 4);
+ fd = mkstemp(SvPVX(sv));
+ }
if (fd >= 0) {
f = PerlIO_fdopen(fd, "w+");
if (f)