Skip to content

Commit 6aedd9f

Browse files
committed
Don't cast to anything (fix review finding)
1 parent 1b8a026 commit 6aedd9f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/fcntl.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,18 +450,26 @@ fn readlink_maybe_at<P: ?Sized + NixPath>(
450450
match dirfd {
451451
#[cfg(target_os = "redox")]
452452
Some(_) => unreachable!(),
453-
#[cfg(not(target_os = "redox"))]
453+
#[cfg(not(any(target_os = "redox", target_os = "nto")))]
454+
Some(dirfd) => libc::readlinkat(
455+
dirfd,
456+
cstr.as_ptr(),
457+
v.as_mut_ptr().cast(),
458+
v.capacity() as size_t,
459+
),
460+
// On Neutrino QNX, libc::readlinkat returns an `int` instead of ssize_t
461+
#[cfg(target_os = "nto")]
454462
Some(dirfd) => libc::readlinkat(
455463
dirfd,
456464
cstr.as_ptr(),
457465
v.as_mut_ptr().cast(),
458466
v.capacity() as size_t,
459-
) as _,
467+
) as libc::ssize_t,
460468
None => libc::readlink(
461469
cstr.as_ptr(),
462470
v.as_mut_ptr().cast(),
463471
v.capacity() as size_t,
464-
) as _,
472+
),
465473
}
466474
})
467475
}

0 commit comments

Comments
 (0)