From de26ed56746c0af95afe99c00b798b6d5384e84c Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Tue, 20 Jun 2017 06:55:40 -0700 Subject: [PATCH] Increase the number of use cases file_size() works correctly, per JuhaSointusalo. Juha had a good point in pull-request #1860, capture the bug fix before it gets lost in the sands of time. --- lib/filesys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/filesys.cpp b/lib/filesys.cpp index a54e833587..922c9fa736 100644 --- a/lib/filesys.cpp +++ b/lib/filesys.cpp @@ -351,7 +351,7 @@ int boinc_delete_file(const char* path) { // int file_size(const char* path, double& size) { #if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__MINGW32__) - HANDLE h = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + HANDLE h = CreateFileA(path, 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, 0, OPEN_EXISTING, 0, 0); if (h == INVALID_HANDLE_VALUE) return ERR_STAT; LARGE_INTEGER lisize; if (GetFileSizeEx(h, &lisize)) {