From bf465dd5036d1f3f3fd3812f737579b1f795ca83 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 25 Feb 2019 11:44:19 +0000 Subject: win32: fake permissions/ownership for inaccessible files If stat(2) knows a file exists but can't obtain additional metadata for it give it root ownership and no permissions for other. --- win32/mingw.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'win32') diff --git a/win32/mingw.c b/win32/mingw.c index 84522d3ea..378c4001f 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -448,6 +448,11 @@ static int do_lstat(int follow, const char *file_name, struct mingw_stat *buf) (((ino_t)hdata.nFileIndexHigh)<<32); buf->st_nlink = S_ISDIR(buf->st_mode) ? 2 : hdata.nNumberOfLinks; } + else { + buf->st_uid = 0; + buf->st_gid = 0; + buf->st_mode &= ~(S_IROTH|S_IWOTH|S_IXOTH); + } CloseHandle(fh); #endif -- cgit v1.2.3-55-g6feb