File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -1070,7 +1070,19 @@ int mingw_stat(const char *file_name, struct stat *buf)
1070
1070
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE , NULL ,
1071
1071
OPEN_EXISTING , FILE_FLAG_BACKUP_SEMANTICS , NULL );
1072
1072
if (hnd == INVALID_HANDLE_VALUE ) {
1073
- errno = err_win_to_posix (GetLastError ());
1073
+ DWORD err = GetLastError ();
1074
+
1075
+ if (err == ERROR_ACCESS_DENIED &&
1076
+ !mingw_lstat (file_name , buf ) &&
1077
+ !S_ISLNK (buf -> st_mode ))
1078
+ /*
1079
+ * POSIX semantics state to still try to fill
1080
+ * information, even if permission is denied to create
1081
+ * a file handle.
1082
+ */
1083
+ return 0 ;
1084
+
1085
+ errno = err_win_to_posix (err );
1074
1086
return -1 ;
1075
1087
}
1076
1088
result = get_file_info_by_handle (hnd , buf );
You can’t perform that action at this time.
0 commit comments