am 00ed9870: Fix error checking in get_temp_file_name().

* commit '00ed9870d98b93d8a6438e5cf9058ebbe10dab01':
  Fix error checking in get_temp_file_name().
This commit is contained in:
Dan Albert
2015-02-13 17:59:30 +00:00
committed by Android Git Automerger

View File

@@ -69,10 +69,13 @@ get_temp_file_name()
std::string Name;
int FD = -1;
do {
Name = "libcxx.XXXXXX";
FD = mkstemp(&Name[0]);
assert(errno != EINVAL && "Something is wrong with the mkstemp's argument");
} while (FD == -1 || errno == EEXIST);
Name = "libcxx.XXXXXX";
FD = mkstemp(&Name[0]);
if (FD == -1 && errno == EINVAL) {
perror("mkstemp");
abort();
}
} while (FD == -1);
close(FD);
return Name;
#endif