[llvm] r185825 - Fixes problem when calling llvm-ar from an unmodifiable directory.

Manuel Klimek klimek at google.com
Mon Jul 8 07:44:57 PDT 2013


Author: klimek
Date: Mon Jul  8 09:44:57 2013
New Revision: 185825

URL: http://llvm.org/viewvc/llvm-project?rev=185825&view=rev
Log:
Fixes problem when calling llvm-ar from an unmodifiable directory.

This fixes a regression introduced by r185726: the new call to get
a unique file does not prepend the system temporary directory, so
we need to anchor on the file that the temporary file gets moved
to to ensure we're on the same file system.

Modified:
    llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp

Modified: llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp?rev=185825&r1=185824&r2=185825&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp (original)
+++ llvm/trunk/tools/llvm-ar/ArchiveWriter.cpp Mon Jul  8 09:44:57 2013
@@ -260,8 +260,8 @@ bool Archive::writeToDisk(bool TruncateN
   // Create a temporary file to store the archive in
   int TmpArchiveFD;
   SmallString<128> TmpArchive;
-  error_code EC = sys::fs::createUniqueFile("temp-archive-%%%%%%%.a",
-                                            TmpArchiveFD, TmpArchive);
+  error_code EC = sys::fs::createUniqueFile(
+      archPath + ".temp-archive-%%%%%%%.a", TmpArchiveFD, TmpArchive);
   if (EC)
     return true;
 





More information about the llvm-commits mailing list