diff options
author | Jeremy Day <jadaytime@gmail.com> | 2024-03-26 21:03:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 21:03:29 -0700 |
commit | 9961c03e9ec2fc47cb42fd16141b89dd8d8e2c01 (patch) | |
tree | 115d9d164bdb92928ab43dc06cb643aebfdfc53f /llvm/lib/Object/COFFImportFile.cpp | |
parent | 4d03a9ecc697a11f0edd3c31440a7cae3398e24a (diff) | |
download | llvm-9961c03e9ec2fc47cb42fd16141b89dd8d8e2c01.zip llvm-9961c03e9ec2fc47cb42fd16141b89dd8d8e2c01.tar.gz llvm-9961c03e9ec2fc47cb42fd16141b89dd8d8e2c01.tar.bz2 |
Return `errc::no_such_file_or_directory` in `fs::access` if `GetFileAttributesW` fails (#83495)
Fixes https://github.com/llvm/llvm-project/issues/83046
There is a race condition when calling `GetFileAttributesW` that can
cause it to return `ERROR_ACCESS_DENIED` on a path which exists, which
is unexpected for callers using this function to check for file
existence by passing `AccessMode::Exist`. This was manifesting as a
compiler crash on Windows downstream in the Swift compiler when using
the `-index-store-path` flag (more information in
https://github.com/apple/llvm-project/issues/8224).
I looked for alternate APIs to avoid bringing in `shlwapi.h`, but didn't
see any good candidates. I'm not tied at all to this solution, any
feedback and alternative approaches are more than welcome.
Diffstat (limited to 'llvm/lib/Object/COFFImportFile.cpp')
0 files changed, 0 insertions, 0 deletions