diff options
| author | bors <bors@rust-lang.org> | 2023-02-13 23:20:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-13 23:20:03 +0000 |
| commit | 5348a89a77a49f6f57c13c0edf7f493fd410159a (patch) | |
| tree | ed4cb2e46a8cc7e1ae301dc7b76a503dc5b64260 /library/std/src | |
| parent | 065852def0903296da33a9eaf557f230bcf3a61a (diff) | |
| parent | f1a349457fe7c064cd63d14c20bc5d9519d20dc6 (diff) | |
| download | rust-5348a89a77a49f6f57c13c0edf7f493fd410159a.tar.gz rust-5348a89a77a49f6f57c13c0edf7f493fd410159a.zip | |
Auto merge of #108015 - matthiaskrgr:rollup-qerohjn, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #107902 (fix: improve the suggestion on future not awaited) - #107913 (Update broken link in cargo style guide) - #107942 (Tighter spans for bad inherent `impl` self types) - #107948 (Allow shortcuts to directories to be used for ./x.py fmt) - #107971 (Clearly document intentional UB in mir-opt tests) - #107985 (Added another error to be processed in fallback) - #108002 (Update books) - #108013 (rustdoc: use a string with one-character codes for search index types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/windows/fs.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs index f1a784b5fd2..d2c597664fa 100644 --- a/library/std/src/sys/windows/fs.rs +++ b/library/std/src/sys/windows/fs.rs @@ -1266,7 +1266,12 @@ fn metadata(path: &Path, reparse: ReparsePoint) -> io::Result<FileAttr> { // If the fallback fails for any reason we return the original error. match File::open(path, &opts) { Ok(file) => file.file_attr(), - Err(e) if e.raw_os_error() == Some(c::ERROR_SHARING_VIOLATION as _) => { + Err(e) + if [Some(c::ERROR_SHARING_VIOLATION as _), Some(c::ERROR_ACCESS_DENIED as _)] + .contains(&e.raw_os_error()) => + { + // `ERROR_ACCESS_DENIED` is returned when the user doesn't have permission for the resource. + // One such example is `System Volume Information` as default but can be created as well // `ERROR_SHARING_VIOLATION` will almost never be returned. // Usually if a file is locked you can still read some metadata. // However, there are special system files, such as |
