From fdff0f9e8077fcf0e25a567c2be9e8da71c1676d Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 30 Apr 2024 15:26:04 +0100 Subject: win32: try to avoid downloading offline files It's possible that files in remote storage may not be available locally. Avoid downloading such files just to obtain file attributes. (GitHub issue #414) --- win32/mingw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/win32/mingw.c b/win32/mingw.c index 8669cc137..d3daf8315 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -700,7 +700,9 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) /* The file is not a symlink. */ buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); if (S_ISREG(buf->st_mode) && - (has_exe_suffix(file_name) || has_exec_format(file_name))) + (has_exe_suffix(file_name) || + (!(buf->st_attr & FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS) && + has_exec_format(file_name)))) buf->st_mode |= S_IXUSR|S_IXGRP|S_IXOTH; buf->st_size = fdata.nFileSizeLow | (((off64_t)fdata.nFileSizeHigh)<<32); @@ -711,7 +713,8 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) buf->st_nlink = (buf->st_attr & FILE_ATTRIBUTE_DIRECTORY) ? 2 : 1; #if ENABLE_FEATURE_EXTRA_FILE_DATA - if (!(buf->st_attr & FILE_ATTRIBUTE_DEVICE)) { + if (!(buf->st_attr & + (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS))) { DWORD flags; HANDLE fh; BY_HANDLE_FILE_INFORMATION hdata; -- cgit v1.2.3-55-g6feb