[llvm-commits] [llvm] r53929 - /llvm/trunk/lib/System/Unix/Path.inc
Devang Patel
dpatel at apple.com
Tue Jul 22 13:02:39 PDT 2008
Author: dpatel
Date: Tue Jul 22 15:02:39 2008
New Revision: 53929
URL: http://llvm.org/viewvc/llvm-project?rev=53929&view=rev
Log:
While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
Modified:
llvm/trunk/lib/System/Unix/Path.inc
Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=53929&r1=53928&r2=53929&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Tue Jul 22 15:02:39 2008
@@ -746,8 +746,14 @@
// 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;
More information about the llvm-commits
mailing list