diff --git a/test/support/platform_support.h b/test/support/platform_support.h index 7900bbf84..9ae2ae7cb 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;