summaryrefslogtreecommitdiff
path: root/perlio.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-19 18:50:32 +0000
committerZefram <zefram@fysh.org>2017-12-22 16:26:38 +0000
commitd333cbeb476c54aaf8f85ffdcfc187f23b4ea2ee (patch)
treef4ccafab5d5661caa83ff8da54e4d67b02f96aaa /perlio.c
parent2517ba9951b6aed3ab780dc0247c90deff825b4e (diff)
downloadperl-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.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/perlio.c b/perlio.c
index 2a57772c46..d9fdac3f90 100644
--- a/perlio.c
+++ b/perlio.c
@@ -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) {