Fix get_temp_file_name() to compile on Windows. Patch from STL@microsoft.com

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@267963 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/support/platform_support.h b/test/support/platform_support.h
index 63311a5..f5981d1 100644
--- a/test/support/platform_support.h
+++ b/test/support/platform_support.h
@@ -53,7 +53,7 @@
 #include <stdlib.h>
 #include <string>
 #if defined(_WIN32) || defined(__MINGW32__)
-#include <io.h> // _mktemp
+#include <io.h> // _mktemp_s
 #else
 #include <unistd.h> // close
 #endif
@@ -71,11 +71,13 @@
 get_temp_file_name()
 {
 #if defined(_WIN32) || defined(__MINGW32__)
-    char Path[MAX_PATH+1];
-    char FN[MAX_PATH+1];
-    do { } while (0 == GetTempPath(MAX_PATH+1, Path));
-    do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN));
-    return FN;
+    char Name[] = "libcxx.XXXXXX";
+
+    if (_mktemp_s(Name, sizeof(Name)) != 0) {
+        abort();
+    }
+
+    return Name;
 #else
     std::string Name;
     int FD = -1;