File tree 1 file changed +6
-1
lines changed
library/std/src/sys/windows
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> {
1266
1266
// If the fallback fails for any reason we return the original error.
1267
1267
match File :: open ( path, & opts) {
1268
1268
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
1270
1275
// `ERROR_SHARING_VIOLATION` will almost never be returned.
1271
1276
// Usually if a file is locked you can still read some metadata.
1272
1277
// However, there are special system files, such as
You can’t perform that action at this time.
0 commit comments