Skip to content

Commit

Permalink
Don't cast to anything (fix review finding)
Browse files Browse the repository at this point in the history
  • Loading branch information
flba-eb committed Mar 31, 2024
1 parent b1008cb commit e6c6d7c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/fcntl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,18 +449,26 @@ fn readlink_maybe_at<P: ?Sized + NixPath>(
match dirfd {
#[cfg(target_os = "redox")]
Some(_) => unreachable!(),
#[cfg(not(target_os = "redox"))]
#[cfg(not(any(target_os = "redox", target_os = "nto")))]
Some(dirfd) => libc::readlinkat(
dirfd,
cstr.as_ptr(),
v.as_mut_ptr().cast(),
v.capacity() as size_t,
),
// On Neutrino QNX, libc::readlinkat returns an `int` instead of ssize_t
#[cfg(target_os = "nto")]
Some(dirfd) => libc::readlinkat(
dirfd,
cstr.as_ptr(),
v.as_mut_ptr().cast(),
v.capacity() as size_t,
) as _,
) as libc::ssize_t,
None => libc::readlink(
cstr.as_ptr(),
v.as_mut_ptr().cast(),
v.capacity() as size_t,
) as _,
),
}
})
}
Expand Down

0 comments on commit e6c6d7c

Please sign in to comment.