From 14a90253a34f49fd2bf1f17dd84ee6faa1db3af7 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Thu, 6 Jun 2019 15:47:53 +0200 Subject: [PATCH] Fix tmp dir in configure.cmake (#25003) The ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS check was using a temp path that had some non-existent components. While this works fine on Linux, it fails to create the temp file on OSX. The fix is to use temp dir in the CMake's output dir. --- src/pal/src/configure.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake index 066bd52..4d00b72 100644 --- a/src/pal/src/configure.cmake +++ b/src/pal/src/configure.cmake @@ -539,9 +539,10 @@ check_cxx_source_runs(" #include #include #include +#include #define MEM_SIZE 1024 - +#define TEMP_FILE_TEMPLATE \"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/multiplemaptestXXXXXX\" int main(void) { char * fname; @@ -549,10 +550,10 @@ int main(void) int ret; void * pAddr0, * pAddr1; - fname = (char *)malloc(MEM_SIZE); + fname = (char *)malloc(std::max((size_t)MEM_SIZE, sizeof(TEMP_FILE_TEMPLATE))); if (!fname) exit(1); - strcpy(fname, \"/tmp/name/multiplemaptestXXXXXX\"); + strcpy(fname, TEMP_FILE_TEMPLATE); fd = mkstemp(fname); if (fd < 0) -- 2.7.4