Archive: Fix temp path names.
authorMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 17 Jan 2011 16:43:30 +0000 (16:43 +0000)
committerMichael J. Spencer <bigcheesegs@gmail.com>
Mon, 17 Jan 2011 16:43:30 +0000 (16:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123660 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Archive/ArchiveWriter.cpp

index 59fb7bdd3ffdb20abe0717cb1697af29eb5ef364..c5ad5fc41cd116b29ddbc8fd1e9c4e400b472b81 100644 (file)
@@ -364,8 +364,9 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
   // Create a temporary file to store the archive in
   SmallString<128> TempArchivePath;
   int ArchFD;
-  if (error_code ec = sys::fs::unique_file("%%-%%-%%-%%" + archPath.str(),
-                                                 ArchFD, TempArchivePath)) {
+  if (error_code ec =
+      sys::fs::unique_file("%%-%%-%%-%%-" + sys::path::filename(archPath.str()),
+                           ArchFD, TempArchivePath)) {
     if (ErrMsg) *ErrMsg = ec.message();
     return true;
   }
@@ -421,8 +422,9 @@ Archive::writeToDisk(bool CreateSymbolTable, bool TruncateNames, bool Compress,
 
     // Open another temporary file in order to avoid invalidating the
     // mmapped data
-    if (error_code ec = sys::fs::unique_file("%%-%%-%%-%%" + archPath.str(),
-                                      ArchFD, TempArchiveWithSymbolTablePath)) {
+    if (error_code ec =
+      sys::fs::unique_file("%%-%%-%%-%%-" + sys::path::filename(archPath.str()),
+                           ArchFD, TempArchiveWithSymbolTablePath)) {
       if (ErrMsg) *ErrMsg = ec.message();
       return true;
     }