From ae2b90b86d131d118bb9f54b6b93edd0384cd7b0 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sun, 6 Oct 2013 21:14:05 +0000 Subject: [PATCH] G M: 1. It changes the temp file handling to use the template and the current directory for windows, matching how it works on other platforms. 2. It re-enables the temp file handling for mingw that regressed. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192073 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/support/platform_support.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/support/platform_support.h b/test/support/platform_support.h index 7900bbf8..9ae2ae7c 100644 --- a/test/support/platform_support.h +++ b/test/support/platform_support.h @@ -42,19 +42,18 @@ #include #include #include +#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) +#include // _mktemp +#endif inline std::string get_temp_file_name() { -#ifdef _LIBCPP_MSVCRT - char* p = _tempnam( NULL, NULL ); - if (p == nullptr) - abort(); - std::string s(p); - free( p ); -#else std::string s("temp.XXXXXX"); +#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) + _mktemp(&s[0]); +#else mktemp(&s[0]); #endif return s;