Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: test/support/platform_support.h

Issue 1092513002: Cherrypick 229035: Fix error checking in get_temp_file_name(). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-libcxx.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698