summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@linux.vnet.ibm.com>2018-03-02 10:19:43 +1100
committerVladislav Vaintroub <wlad@mariadb.com>2018-05-21 16:34:11 +0000
commitf165077aa9b9df874a712d731e16968eb30875d4 (patch)
tree1c30b8b62638db66e47a64331e21be2b417bf681
parentd5db2f1084b2e7d85caf26781ea1382881c72bdd (diff)
downloadmariadb-git-f165077aa9b9df874a712d731e16968eb30875d4.tar.gz
MDEV-8743: use mkostemp when available with O_CLOEXEC
Closes #639
-rw-r--r--cmake/os/WindowsCache.cmake1
-rw-r--r--config.h.cmake1
-rw-r--r--configure.cmake1
-rw-r--r--mysys/mf_tempfile.c4
4 files changed, 6 insertions, 1 deletions
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 0b0923fb8c4..1ff4a88892a 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -100,6 +100,7 @@ SET(HAVE_MEMCPY 1 CACHE INTERNAL "")
SET(HAVE_MEMMOVE 1 CACHE INTERNAL "")
SET(HAVE_MEMORY_H 1 CACHE INTERNAL "")
SET(HAVE_MKSTEMP CACHE INTERNAL "")
+SET(HAVE_MKOSTEMP CACHE INTERNAL "")
SET(HAVE_MLOCK CACHE INTERNAL "")
SET(HAVE_MLOCKALL CACHE INTERNAL "")
SET(HAVE_MMAP CACHE INTERNAL "")
diff --git a/config.h.cmake b/config.h.cmake
index 7e480be0380..0a4007d5ebf 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -181,6 +181,7 @@
#cmakedefine HAVE_MEMCPY 1
#cmakedefine HAVE_MEMMOVE 1
#cmakedefine HAVE_MKSTEMP 1
+#cmakedefine HAVE_MKOSTEMP 1
#cmakedefine HAVE_MLOCKALL 1
#cmakedefine HAVE_MMAP 1
#cmakedefine HAVE_MMAP64 1
diff --git a/configure.cmake b/configure.cmake
index 8a83e46488e..96b08df3891 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -370,6 +370,7 @@ CHECK_FUNCTION_EXISTS (mallinfo HAVE_MALLINFO)
CHECK_FUNCTION_EXISTS (memcpy HAVE_MEMCPY)
CHECK_FUNCTION_EXISTS (memmove HAVE_MEMMOVE)
CHECK_FUNCTION_EXISTS (mkstemp HAVE_MKSTEMP)
+CHECK_FUNCTION_EXISTS (mkostemp HAVE_MKOSTEMP)
CHECK_FUNCTION_EXISTS (mlock HAVE_MLOCK)
CHECK_FUNCTION_EXISTS (mlockall HAVE_MLOCKALL)
CHECK_FUNCTION_EXISTS (mmap HAVE_MMAP)
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index 40787c77295..1abb3bca814 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -22,7 +22,9 @@
#include <paths.h>
#endif
-
+#ifdef HAVE_MKOSTEMP
+#define mkstemp(A) mkostemp(A, O_CLOEXEC)
+#endif
/*
@brief