mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 03:53:04 +02:00
While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
llvm-svn: 53929
This commit is contained in:
parent
901d469e05
commit
4057e8691a
@ -746,8 +746,14 @@ Path::makeUnique(bool reuse_current, std::string* ErrMsg) {
|
||||
// Append an XXXXXX pattern to the end of the file for use with mkstemp,
|
||||
// mktemp or our own implementation.
|
||||
char *FNBuffer = (char*) alloca(path.size()+8);
|
||||
path.copy(FNBuffer,path.size());
|
||||
strcpy(FNBuffer+path.size(), "-XXXXXX");
|
||||
if (isDirectory()) {
|
||||
std::string dirPath = getDirname();
|
||||
strcpy(FNBuffer, dirPath.c_str());
|
||||
strcpy(FNBuffer+dirPath.size(), "XXXXXX");
|
||||
} else {
|
||||
path.copy(FNBuffer,path.size());
|
||||
strcpy(FNBuffer+path.size(), "-XXXXXX");
|
||||
}
|
||||
|
||||
#if defined(HAVE_MKSTEMP)
|
||||
int TempFD;
|
||||
|
Loading…
Reference in New Issue
Block a user