diff options
author | Zefram <zefram@fysh.org> | 2017-12-19 18:50:32 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-22 16:26:38 +0000 |
commit | d333cbeb476c54aaf8f85ffdcfc187f23b4ea2ee (patch) | |
tree | f4ccafab5d5661caa83ff8da54e4d67b02f96aaa /perlio.c | |
parent | 2517ba9951b6aed3ab780dc0247c90deff825b4e (diff) | |
download | perl-d333cbeb476c54aaf8f85ffdcfc187f23b4ea2ee.tar.gz |
use Perl_my_mkstemp() where appropriate
Since commit e48855bdd2fc57fc51156f5e4b8dee6b544456c8 there has been
no need to be conditional about using mkstemp(). Perl_my_mkstemp()
is always available, one way or another.
Diffstat (limited to 'perlio.c')
-rw-r--r-- | perlio.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -49,11 +49,6 @@ #include "XSUB.h" -#ifdef __Lynx__ -/* Missing proto on LynxOS */ -int mkstemp(char*); -#endif - #ifdef VMS #include <rms.h> #endif @@ -5034,32 +5029,29 @@ PerlIO_tmpfile(void) const int fd = win32_tmpfd(); if (fd >= 0) f = PerlIO_fdopen(fd, "w+b"); -#elif defined(HAS_MKSTEMP) && ! defined(VMS) && ! defined(OS2) +#elif ! defined(VMS) && ! defined(OS2) int fd = -1; char tempname[] = "/tmp/PerlIO_XXXXXX"; const char * const tmpdir = TAINTING_get ? NULL : PerlEnv_getenv("TMPDIR"); SV * sv = NULL; int old_umask = umask(0177); - /* - * I have no idea how portable mkstemp() is ... NI-S - */ if (tmpdir && *tmpdir) { /* if TMPDIR is set and not empty, we try that first */ sv = newSVpv(tmpdir, 0); sv_catpv(sv, tempname + 4); - fd = mkstemp(SvPVX(sv)); + fd = Perl_my_mkstemp(SvPVX(sv)); } if (fd < 0) { SvREFCNT_dec(sv); sv = NULL; /* else we try /tmp */ - fd = mkstemp(tempname); + fd = Perl_my_mkstemp(tempname); } if (fd < 0) { /* Try cwd */ sv = newSVpvs("."); sv_catpv(sv, tempname + 4); - fd = mkstemp(SvPVX(sv)); + fd = Perl_my_mkstemp(SvPVX(sv)); } umask(old_umask); if (fd >= 0) { |