aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--win32/mingw.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index bfc1531fb..847e7f6a5 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -444,7 +444,7 @@ static int has_exec_format(const char *name)
444 return 0; 444 return 0;
445 445
446 /* Open file and try to avoid updating access time */ 446 /* Open file and try to avoid updating access time */
447 fh = CreateFileA(name, GENERIC_ALL, 0, NULL, OPEN_EXISTING, 0, NULL); 447 fh = CreateFileA(name, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
448 if (fh != INVALID_HANDLE_VALUE) { 448 if (fh != INVALID_HANDLE_VALUE) {
449 FILETIME last_access = { 0xffffffff, 0xffffffff }; 449 FILETIME last_access = { 0xffffffff, 0xffffffff };
450 450
@@ -725,14 +725,14 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf)
725 } 725 }
726#endif 726#endif
727 727
728 /* Get actual size of compressed/sparse files */ 728 /* Get actual size of compressed/sparse files. Only regular
729 low = GetCompressedFileSize(file_name, &high); 729 * files need to be considered. */
730 if ((low == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) || 730 size = buf->st_size;
731 (buf->st_attr & FILE_ATTRIBUTE_DIRECTORY)) { 731 if (S_ISREG(buf->st_mode)) {
732 size = buf->st_size; 732 low = GetCompressedFileSize(file_name, &high);
733 } 733 if (low != INVALID_FILE_SIZE || GetLastError() == NO_ERROR) {
734 else { 734 size = low | (((off64_t)high)<<32);
735 size = low | (((off64_t)high)<<32); 735 }
736 } 736 }
737 737
738 /* 738 /*