Skip to content

Commit f5bdc81

Browse files
committed
Use ERROR_STOPPED_ON_SYMLINK on Windows for symlink errors.
When `FollowSymlinks::No` and a symlink is encountered, on Windows, use `ERROR_STOPPED_ON_SYMLINK` as the error code.
1 parent 0e44897 commit f5bdc81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cap-primitives/src/windows/fs/open_unchecked.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(crate) fn open_unchecked(
4848
// them as a distinct error.
4949
if metadata.file_type().is_symlink() {
5050
return Err(OpenUncheckedError::Symlink(
51-
io::Error::new(io::ErrorKind::Other, "symlink encountered"),
51+
io::Error::from_raw_os_error(winerror::ERROR_STOPPED_ON_SYMLINK as i32),
5252
if metadata.file_attributes() & FILE_ATTRIBUTE_DIRECTORY
5353
== FILE_ATTRIBUTE_DIRECTORY
5454
{

0 commit comments

Comments
 (0)