Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===----------------------------------------------------------------------===// | 1 //===----------------------------------------------------------------------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is dual licensed under the MIT and the University of Illinois Open | 5 // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 // Source Licenses. See LICENSE.TXT for details. | 6 // Source Licenses. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 | 9 |
| 10 // Define a bunch of macros that can be used in the tests instead of | 10 // Define a bunch of macros that can be used in the tests instead of |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) | 55 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__) |
| 56 char Path[MAX_PATH+1]; | 56 char Path[MAX_PATH+1]; |
| 57 char FN[MAX_PATH+1]; | 57 char FN[MAX_PATH+1]; |
| 58 do { } while (0 == GetTempPath(MAX_PATH+1, Path)); | 58 do { } while (0 == GetTempPath(MAX_PATH+1, Path)); |
| 59 do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN)); | 59 do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN)); |
| 60 return FN; | 60 return FN; |
| 61 #else | 61 #else |
| 62 std::string Name; | 62 std::string Name; |
| 63 int FD = -1; | 63 int FD = -1; |
| 64 do { | 64 do { |
| 65 Name = "libcxx.XXXXXX"; | 65 Name = "libcxx.XXXXXX"; |
| 66 FD = mkstemp(&Name[0]); | 66 FD = mkstemp(&Name[0]); |
| 67 assert(errno != EINVAL && "Something is wrong with the mkstemp's argument" ); | 67 if (FD == -1 && errno == EINVAL) { |
|
Roland McGrath
2015/04/15 22:35:22
This makes an assert into something not affected b
jvoung (off chromium)
2015/04/15 22:45:33
I think the way it is now without the assert is ok
| |
| 68 } while (FD == -1 || errno == EEXIST); | 68 perror("mkstemp"); |
| 69 abort(); | |
| 70 } | |
| 71 } while (FD == -1); | |
|
Roland McGrath
2015/04/15 22:35:22
do ... while (FD == -1 && errno != EEXIST);
seems
Sam Clegg
2015/04/15 22:40:10
Yes, we couldn't figure out why they would want a
| |
| 69 close(FD); | 72 close(FD); |
| 70 return Name; | 73 return Name; |
| 71 #endif | 74 #endif |
| 72 } | 75 } |
| 73 | 76 |
| 74 #endif // PLATFORM_SUPPORT_H | 77 #endif // PLATFORM_SUPPORT_H |
| OLD | NEW |