From eaf200e54d4d0bb0ce2ea84ec4f21409d7a80eb6 Mon Sep 17 00:00:00 2001 From: Juha Sointusalo Date: Thu, 3 Aug 2017 23:07:53 +0300 Subject: [PATCH] lib: fix boinc_file_exists() on Windows The function is documented to check if anything exists at the given path. The client depends on this behavior. If the function checks only for regular files the client will fail to clean up slot directories before using them for another task. Fix the function to match the documentation. --- lib/filesys.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/filesys.cpp b/lib/filesys.cpp index 922c9fa736..db904113a9 100644 --- a/lib/filesys.cpp +++ b/lib/filesys.cpp @@ -547,9 +547,7 @@ int boinc_file_exists(const char* path) { #ifdef _WIN32 // don't use _stat64 because it doesn't work with VS2015, XP client DWORD dwAttrib = GetFileAttributesA(path); - return (dwAttrib != INVALID_FILE_ATTRIBUTES - && !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY) - ); + return dwAttrib != INVALID_FILE_ATTRIBUTES; #else struct stat buf; if (stat(path, &buf)) {