diff options
| author | Eric Fiselier <eric@efcs.ca> | 2016-04-29 00:51:24 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2016-04-29 00:51:24 +0000 |
| commit | 903f1ab93a0d16e2ded28739584ff5e048cc5606 (patch) | |
| tree | 5fa6eb2be25a4fda9bcdf0c3c771a31a27f127a3 | |
| parent | a643eb7ec0ffb6bda6060cceefbcc321a5cc0fa7 (diff) | |
| download | bcm5719-llvm-903f1ab93a0d16e2ded28739584ff5e048cc5606.tar.gz bcm5719-llvm-903f1ab93a0d16e2ded28739584ff5e048cc5606.zip | |
Fix get_temp_file_name() to compile on Windows. Patch from STL@microsoft.com
llvm-svn: 267963
| -rw-r--r-- | libcxx/test/support/platform_support.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h index 63311a52144..f5981d1d087 100644 --- a/libcxx/test/support/platform_support.h +++ b/libcxx/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 @@ std::string 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; |

