Skip to content

Commit ddc281e

Browse files
committed
Don't cast to anything (fix review finding)
1 parent 84821a0 commit ddc281e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn main() {
1515
watchos: { target_os = "watchos" },
1616
tvos: { target_os = "tvos" },
1717
visionos: { target_os = "visionos" },
18+
nto_qnx: { target_os = "nto"},
1819

1920

2021
// cfg aliases we would like to use

src/fcntl.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,18 +459,26 @@ fn readlink_maybe_at<P: ?Sized + NixPath>(
459459
match dirfd {
460460
#[cfg(target_os = "redox")]
461461
Some(_) => unreachable!(),
462-
#[cfg(not(target_os = "redox"))]
462+
#[cfg(not(any(target_os = "redox", target_os = "nto")))]
463+
Some(dirfd) => libc::readlinkat(
464+
dirfd,
465+
cstr.as_ptr(),
466+
v.as_mut_ptr().cast(),
467+
v.capacity() as size_t,
468+
),
469+
// On Neutrino QNX, libc::readlinkat returns an `int` instead of ssize_t
470+
#[cfg(target_os = "nto")]
463471
Some(dirfd) => libc::readlinkat(
464472
dirfd,
465473
cstr.as_ptr(),
466474
v.as_mut_ptr().cast(),
467475
v.capacity() as size_t,
468-
) as _,
476+
) as libc::ssize_t,
469477
None => libc::readlink(
470478
cstr.as_ptr(),
471479
v.as_mut_ptr().cast(),
472480
v.capacity() as size_t,
473-
) as _,
481+
),
474482
}
475483
})
476484
}

0 commit comments

Comments
 (0)