File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -1266,7 +1266,12 @@ fn metadata(path: &Path, reparse: ReparsePoint) -> io::Result<FileAttr> {
12661266 // If the fallback fails for any reason we return the original error.
12671267 match File :: open ( path, & opts) {
12681268 Ok ( file) => file. file_attr ( ) ,
1269- Err ( e) if e. raw_os_error ( ) == Some ( c:: ERROR_SHARING_VIOLATION as _ ) => {
1269+ Err ( e)
1270+ if [ Some ( c:: ERROR_SHARING_VIOLATION as _ ) , Some ( c:: ERROR_ACCESS_DENIED as _ ) ]
1271+ . contains ( & e. raw_os_error ( ) ) =>
1272+ {
1273+ // `ERROR_ACCESS_DENIED` is returned when the user doesn't have permission for the resource.
1274+ // One such example is `System Volume Information` as default but can be created as well
12701275 // `ERROR_SHARING_VIOLATION` will almost never be returned.
12711276 // Usually if a file is locked you can still read some metadata.
12721277 // However, there are special system files, such as
You can’t perform that action at this time.
0 commit comments