Create temp. file in current path.
authorDevang Patel <dpatel@apple.com>
Thu, 24 Jul 2008 00:35:38 +0000 (00:35 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 24 Jul 2008 00:35:38 +0000 (00:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53973 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Unix/Path.inc

index a0def8d5125ad7269d5fc2891a0678e2e3ca18e5..73ccbfbbbf6aea44eae9f1853db77f5427e77936 100644 (file)
@@ -746,14 +746,11 @@ 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);
-  if (isDirectory()) {
-    std::string dirPath = getDirname();
-    strcpy(FNBuffer, dirPath.c_str());
-    strcpy(FNBuffer+dirPath.size(), "XXXXXX");
-  } else {
     path.copy(FNBuffer,path.size());
+  if (isDirectory())
+    strcpy(FNBuffer+path.size(), "/XXXXXX");
+  else
     strcpy(FNBuffer+path.size(), "-XXXXXX");
-  }
 
 #if defined(HAVE_MKSTEMP)
   int TempFD;