mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 16:17:38 +00:00
[Support] Make sure sys::fs::remove can remove symbolic links and make sure LockFileManager can handle a symbolic link that points nowhere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204422 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,16 +29,13 @@ using namespace llvm;
|
||||
/// \returns The process ID of the process that owns this lock file
|
||||
Optional<std::pair<std::string, int> >
|
||||
LockFileManager::readLockFile(StringRef LockFileName) {
|
||||
// Check whether the lock file exists. If not, clearly there's nothing
|
||||
// to read, so we just return.
|
||||
if (!sys::fs::exists(LockFileName))
|
||||
return None;
|
||||
|
||||
// Read the owning host and PID out of the lock file. If it appears that the
|
||||
// owning process is dead, the lock file is invalid.
|
||||
std::unique_ptr<MemoryBuffer> MB;
|
||||
if (MemoryBuffer::getFile(LockFileName, MB))
|
||||
if (MemoryBuffer::getFile(LockFileName, MB)) {
|
||||
sys::fs::remove(LockFileName);
|
||||
return None;
|
||||
}
|
||||
|
||||
StringRef Hostname;
|
||||
StringRef PIDStr;
|
||||
|
||||
Reference in New Issue
Block a user