about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/errors.rs
diff options
context:
space:
mode:
authorChris Denton <chris@chrisdenton.dev>2023-10-13 05:54:56 +0100
committerChris Denton <chris@chrisdenton.dev>2023-10-13 06:02:18 +0100
commit2b7fe7e0a1665e079683e2c67d2046aa67517519 (patch)
tree90782f07e479928a18ac5e51417fdb41d66b6345 /compiler/rustc_codegen_gcc/src/errors.rs
parent130ff8cb6c3d62ed66daf652cbb5323d3f93c4fc (diff)
downloadrust-2b7fe7e0a1665e079683e2c67d2046aa67517519.tar.gz
rust-2b7fe7e0a1665e079683e2c67d2046aa67517519.zip
Make try_exists return Ok(true) for Windows UDS
`fs::try_exists` currently fails on Windows if encountering a Unix Domain Socket (UDS). Fix this by checking for an error code that's returned when there's a failure to use a reparse point.

A reparse point is a way to invoke a filesystem filter on a file instead of the file being opened normally. This is used to implement symbolic links (by redirecting to a different path) but also to implement other types of special files such as Unix domain sockets. If the reparse point is not a link type then opening it with `CreateFileW` may fail with `ERROR_CANT_ACCESS_FILE` because the filesystem filter does not implement that operation. This differs from resolving links which may fail with errors such as `ERROR_FILE_NOT_FOUND` or `ERROR_CANT_RESOLVE_FILENAME`.

So `ERROR_CANT_ACCESS_FILE` means that the file exists but that we can't open it normally. Still, the file does exist so `try_exists` should report that as `Ok(true)`.
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/errors.rs')
0 files changed, 0 insertions, 0 deletions