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
This commit is contained in:
Howard Hinnant 2013-10-06 21:14:05 +00:00
parent e064055942
commit ae2b90b86d

View File

@ -42,19 +42,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <string>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include <io.h> // _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;