From c7e3e5ef45c1877d12d6365fbfb68fa840c1518b Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 12 Feb 2021 11:34:22 -0500 Subject: disk_interface: Do not query bits of INVALID_FILE_ATTRIBUTES --- src/disk_interface.cc | 10 +++++----- 1 file 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 -- cgit v0.12