summaryrefslogtreecommitdiff
path: root/lib/System/Unix/Path.inc
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-07-24 00:35:38 +0000
committerDevang Patel <dpatel@apple.com>2008-07-24 00:35:38 +0000
commitbdfa9ac44550ea329468f3309b36c629017f3f3d (patch)
tree94cdab1f80b2c39a2c894c2138a1118607e98a47 /lib/System/Unix/Path.inc
parent9d76c73d9c0ecd38ea88bb192c48f153b7bb9af7 (diff)
downloadllvm-bdfa9ac44550ea329468f3309b36c629017f3f3d.tar.gz
llvm-bdfa9ac44550ea329468f3309b36c629017f3f3d.tar.bz2
llvm-bdfa9ac44550ea329468f3309b36c629017f3f3d.tar.xz
Create temp. file in current path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53973 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Path.inc')
-rw-r--r--lib/System/Unix/Path.inc9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index a0def8d512..73ccbfbbbf 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -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;