summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKMX <kmx@cpan.org>2015-05-14 09:20:08 +0200
committerRicardo Signes <rjbs@cpan.org>2015-05-21 18:19:06 -0400
commitf33b2f585292653a3c50ea39cbdab734c3473fcb (patch)
tree27e743b9d1aea2511b6efca9a72f98305ab8a05f
parent612a06fa463fb0eb4533e07c8f5179ca7d1d26f3 (diff)
downloadperl-f33b2f585292653a3c50ea39cbdab734c3473fcb.tar.gz
handle existing mkstemp() in mingw-w64-v4
-rw-r--r--win32/config_H.gc4
-rw-r--r--win32/win32.c2
-rw-r--r--win32/win32.h2
3 files changed, 7 insertions, 1 deletions
diff --git a/win32/config_H.gc b/win32/config_H.gc
index a549e88920..40ce6c7157 100644
--- a/win32/config_H.gc
+++ b/win32/config_H.gc
@@ -1970,7 +1970,9 @@
* available to exclusively create and open a uniquely named
* temporary file.
*/
-/*#define HAS_MKSTEMP / **/
+#if __MINGW64_VERSION_MAJOR >= 4
+#define HAS_MKSTEMP
+#endif
/* HAS_MMAP:
* This symbol, if defined, indicates that the mmap system call is
diff --git a/win32/win32.c b/win32/win32.c
index a78c598563..879b6130dd 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1124,6 +1124,7 @@ chown(const char *path, uid_t owner, gid_t group)
* XXX this needs strengthening (for PerlIO)
* -- BKS, 11-11-200
*/
+#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 4
int mkstemp(const char *path)
{
dTHX;
@@ -1144,6 +1145,7 @@ retry:
goto retry;
return fd;
}
+#endif
static long
find_pid(pTHX_ int pid)
diff --git a/win32/win32.h b/win32/win32.h
index 8a55202b8e..daefeb84fb 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -352,8 +352,10 @@ extern void *sbrk(ptrdiff_t need);
#endif
extern char * getlogin(void);
extern int chown(const char *p, uid_t o, gid_t g);
+#if !defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 4
extern int mkstemp(const char *path);
#endif
+#endif
#undef Stat
#define Stat win32_stat