diff options
author | Brad King <brad.king@kitware.com> | 2021-02-12 16:34:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-02-12 16:44:45 (GMT) |
commit | c7e3e5ef45c1877d12d6365fbfb68fa840c1518b (patch) | |
tree | a77a3017fe6f570938877b277620ffe724564068 /src | |
parent | a33b81305889e45823b36b3c96cc8db97e5d3b41 (diff) | |
download | Ninja-c7e3e5ef45c1877d12d6365fbfb68fa840c1518b.zip Ninja-c7e3e5ef45c1877d12d6365fbfb68fa840c1518b.tar.gz Ninja-c7e3e5ef45c1877d12d6365fbfb68fa840c1518b.tar.bz2 |
disk_interface: Do not query bits of INVALID_FILE_ATTRIBUTES
Diffstat (limited to 'src')
-rw-r--r-- | src/disk_interface.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/disk_interface.cc b/src/disk_interface.cc index 4753201..6290680 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -267,11 +267,11 @@ FileReader::Status RealDiskInterface::ReadFile(const string& path, int RealDiskInterface::RemoveFile(const string& path) { #ifdef _WIN32 DWORD attributes = GetFileAttributes(path.c_str()); - if (attributes == INVALID_FILE_ATTRIBUTES && - GetLastError() == ERROR_FILE_NOT_FOUND) { - return 1; - } - if (attributes & FILE_ATTRIBUTE_READONLY) { + if (attributes == INVALID_FILE_ATTRIBUTES) { + if (GetLastError() == ERROR_FILE_NOT_FOUND) { + return 1; + } + } else if (attributes & FILE_ATTRIBUTE_READONLY) { // On non-Windows systems, remove() will happily delete read-only files. // On Windows Ninja should behave the same: // https://github.com/ninja-build/ninja/issues/1886 |