diff options
author | Brian Fraser <fraserbn@gmail.com> | 2014-01-21 22:45:17 -0300 |
---|---|---|
committer | Brian Fraser <fraserbn@gmail.com> | 2014-01-21 22:45:17 -0300 |
commit | b7561fc9bc645b8c7e0e9ebbb29349113cb716c1 (patch) | |
tree | 97d66776c5d59056b1cbfdf02e64bae84e68be35 /perlio.c | |
parent | 8a064057e2281eb2b0cca29e1f1046df752abfe1 (diff) | |
download | perl-b7561fc9bc645b8c7e0e9ebbb29349113cb716c1.tar.gz |
perlio.c, PerlIO_tmpfile: Fall back to cwd if we have no /tmp or $TMPDIR
With this, open($fh, undef) will now work on systems without
a /tmp (or equivalent) where TMPDIR is not set.
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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) |