[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
This commit is contained in:
Argyrios Kyrtzidis 2014-03-21 21:45:07 +00:00
parent aa4135aa7f
commit c1011e635c

View File

@ -68,7 +68,11 @@ bool LockFileManager::processStillExecuting(StringRef Hostname, int PID) {
LockFileManager::LockFileManager(StringRef FileName) LockFileManager::LockFileManager(StringRef FileName)
{ {
this->FileName = FileName; this->FileName = FileName;
LockFileName = FileName; if (error_code EC = sys::fs::make_absolute(this->FileName)) {
Error = EC;
return;
}
LockFileName = this->FileName;
LockFileName += ".lock"; LockFileName += ".lock";
// If the lock file already exists, don't bother to try to create our own // 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) { while (1) {
// Create a link from the lock file name. If this succeeds, we're done. // Create a link from the lock file name. If this succeeds, we're done.
error_code EC = error_code EC =
sys::fs::create_link(sys::path::filename(UniqueLockFileName.str()), sys::fs::create_link(UniqueLockFileName.str(), LockFileName.str());
LockFileName.str());
if (EC == errc::success) if (EC == errc::success)
return; return;