summaryrefslogtreecommitdiff
path: root/lib/Support/LockFileManager.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-03-21 21:45:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-03-21 21:45:07 +0000
commitc1011e635c114962452c60da197294080e5dfe2c (patch)
tree68ba084350c0c08960ea817e2933f5a0d1256e8b /lib/Support/LockFileManager.cpp
parentaa4135aa7fbfa2fbacae10f6e58809c20a3a7459 (diff)
downloadllvm-c1011e635c114962452c60da197294080e5dfe2c.tar.gz
llvm-c1011e635c114962452c60da197294080e5dfe2c.tar.bz2
llvm-c1011e635c114962452c60da197294080e5dfe2c.tar.xz
[Support] Follow up to r204426, for LockFileManager, make the given path absolute so relative paths are properly handled in both Windows and Unix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/LockFileManager.cpp')
-rw-r--r--lib/Support/LockFileManager.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Support/LockFileManager.cpp b/lib/Support/LockFileManager.cpp
index 55858473f5..cd1cbcb2c5 100644
--- a/lib/Support/LockFileManager.cpp
+++ b/lib/Support/LockFileManager.cpp
@@ -68,7 +68,11 @@ bool LockFileManager::processStillExecuting(StringRef Hostname, int PID) {
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(StringRef FileName)
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;