aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-04-30 15:26:04 +0100
committerRon Yorston <rmy@pobox.com>2024-04-30 15:26:04 +0100
commitfdff0f9e8077fcf0e25a567c2be9e8da71c1676d (patch)
tree33e0dda1ffaea8bcd868392df5b9ce4703beb806
parent8e0a1ad5e4c1fa3698cc581fedcaf339a3387a35 (diff)
downloadbusybox-w32-fdff0f9e8077fcf0e25a567c2be9e8da71c1676d.tar.gz
busybox-w32-fdff0f9e8077fcf0e25a567c2be9e8da71c1676d.tar.bz2
busybox-w32-fdff0f9e8077fcf0e25a567c2be9e8da71c1676d.zip
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)
-rw-r--r--win32/mingw.c7
1 files 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)
700 /* The file is not a symlink. */ 700 /* The file is not a symlink. */
701 buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes); 701 buf->st_mode = file_attr_to_st_mode(fdata.dwFileAttributes);
702 if (S_ISREG(buf->st_mode) && 702 if (S_ISREG(buf->st_mode) &&
703 (has_exe_suffix(file_name) || has_exec_format(file_name))) 703 (has_exe_suffix(file_name) ||
704 (!(buf->st_attr & FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS) &&
705 has_exec_format(file_name))))
704 buf->st_mode |= S_IXUSR|S_IXGRP|S_IXOTH; 706 buf->st_mode |= S_IXUSR|S_IXGRP|S_IXOTH;
705 buf->st_size = fdata.nFileSizeLow | 707 buf->st_size = fdata.nFileSizeLow |
706 (((off64_t)fdata.nFileSizeHigh)<<32); 708 (((off64_t)fdata.nFileSizeHigh)<<32);
@@ -711,7 +713,8 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf)
711 buf->st_nlink = (buf->st_attr & FILE_ATTRIBUTE_DIRECTORY) ? 2 : 1; 713 buf->st_nlink = (buf->st_attr & FILE_ATTRIBUTE_DIRECTORY) ? 2 : 1;
712 714
713#if ENABLE_FEATURE_EXTRA_FILE_DATA 715#if ENABLE_FEATURE_EXTRA_FILE_DATA
714 if (!(buf->st_attr & FILE_ATTRIBUTE_DEVICE)) { 716 if (!(buf->st_attr &
717 (FILE_ATTRIBUTE_DEVICE | FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS))) {
715 DWORD flags; 718 DWORD flags;
716 HANDLE fh; 719 HANDLE fh;
717 BY_HANDLE_FILE_INFORMATION hdata; 720 BY_HANDLE_FILE_INFORMATION hdata;