From 281f23adc1b76136efd11a410532d0600f6936e8 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 11 Sep 2014 20:30:02 +0000 Subject: Misc cleanups to the FileSytem api. The main difference is the removal of std::error_code exists(const Twine &path, bool &result); It was an horribly redundant interface since a file not existing is also a valid error_code. Now we have an access function that returns just an error_code. This is the only function that has to be implemented for Unix and Windows. The functions can_write, exists and can_execute an now just wrappers. One still has to be very careful using these function to avoid introducing race conditions (Time of check to time of use). llvm-svn: 217625 --- llvm/lib/Support/LockFileManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Support/LockFileManager.cpp') diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 8fc58017cb0..5b82c367c0a 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -204,8 +204,8 @@ LockFileManager::WaitForUnlockResult LockFileManager::waitForUnlock() { // If the lock file is still expected to be there, check whether it still // is. if (!LockFileGone) { - bool Exists; - if (!sys::fs::exists(LockFileName.str(), Exists) && !Exists) { + if (sys::fs::access(LockFileName.c_str(), sys::fs::AccessMode::Exist) == + errc::no_such_file_or_directory) { LockFileGone = true; LockFileJustDisappeared = true; } -- cgit v1.2.3