Skip to content

Commit c208568

Browse files
committed
Don't cast to anything (fix review finding)
1 parent 3ee052d commit c208568

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/fcntl.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -449,18 +449,26 @@ fn readlink_maybe_at<P: ?Sized + NixPath>(
449449
match dirfd {
450450
#[cfg(target_os = "redox")]
451451
Some(_) => unreachable!(),
452-
#[cfg(not(target_os = "redox"))]
452+
#[cfg(not(any(target_os = "redox", target_os = "nto")))]
453+
Some(dirfd) => libc::readlinkat(
454+
dirfd,
455+
cstr.as_ptr(),
456+
v.as_mut_ptr().cast(),
457+
v.capacity() as size_t,
458+
),
459+
// On Neutrino QNX, libc::readlinkat returns an `int` instead of ssize_t
460+
#[cfg(target_os = "nto")]
453461
Some(dirfd) => libc::readlinkat(
454462
dirfd,
455463
cstr.as_ptr(),
456464
v.as_mut_ptr().cast(),
457465
v.capacity() as size_t,
458-
) as _,
466+
) as libc::ssize_t,
459467
None => libc::readlink(
460468
cstr.as_ptr(),
461469
v.as_mut_ptr().cast(),
462470
v.capacity() as size_t,
463-
) as _,
471+
),
464472
}
465473
})
466474
}

0 commit comments

Comments
 (0)