[llvm] r204520 - [Support] Follow up to r204426, for LockFileManager, make the given path absolute so relative paths are properly handled in both Windows and Unix.

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Mar 21 14:45:08 PDT 2014


Author: akirtzidis
Date: Fri Mar 21 16:45:07 2014
New Revision: 204520

URL: http://llvm.org/viewvc/llvm-project?rev=204520&view=rev
Log:
[Support] Follow up to r204426, for LockFileManager, make the given path absolute so relative paths are properly handled in both Windows and Unix.

Modified:
    llvm/trunk/lib/Support/LockFileManager.cpp

Modified: llvm/trunk/lib/Support/LockFileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/LockFileManager.cpp?rev=204520&r1=204519&r2=204520&view=diff
==============================================================================
--- llvm/trunk/lib/Support/LockFileManager.cpp (original)
+++ llvm/trunk/lib/Support/LockFileManager.cpp Fri Mar 21 16:45:07 2014
@@ -68,7 +68,11 @@ bool LockFileManager::processStillExecut
 LockFileManager::LockFileManager(StringRef FileName)
 {
   this->FileName = FileName;
-  LockFileName = FileName;
+  if (error_code EC = sys::fs::make_absolute(this->FileName)) {
+    Error = EC;
+    return;
+  }
+  LockFileName = this->FileName;
   LockFileName += ".lock";
 
   // If the lock file already exists, don't bother to try to create our own
@@ -116,8 +120,7 @@ LockFileManager::LockFileManager(StringR
   while (1) {
     // Create a link from the lock file name. If this succeeds, we're done.
     error_code EC =
-        sys::fs::create_link(sys::path::filename(UniqueLockFileName.str()),
-                             LockFileName.str());
+        sys::fs::create_link(UniqueLockFileName.str(), LockFileName.str());
     if (EC == errc::success)
       return;
 





More information about the llvm-commits mailing list