Skip to content

Commit 0756fd9

Browse files
authored
Fix compiling noexec.rs for musl (#1101)
2 parents 06a8f6b + 126dc49 commit 0756fd9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/exec/noexec.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn alloc_notify_allocs() -> NotifyAllocs {
9595
/// `ioctl(fd, request, ptr)` must be safe to call
9696
unsafe fn ioctl<T>(fd: RawFd, request: libc::c_ulong, ptr: *mut T) -> Option<()> {
9797
// SAFETY: By function contract
98-
if unsafe { libc::ioctl(fd, request, ptr) } == -1 {
98+
if unsafe { libc::ioctl(fd, request as _, ptr) } == -1 {
9999
// SAFETY: Trivial
100100
if unsafe { *__errno_location() } == ENOENT {
101101
None
@@ -192,7 +192,7 @@ fn receive_fd(rx_fd: UnixStream) -> RawFd {
192192
// SAFETY: SingleRightAnciliaryData can be zero-initialized.
193193
let mut control: SingleRightAnciliaryData = unsafe { zeroed() };
194194
// SAFETY: The buf field is valid when zero-initialized.
195-
msg.msg_controllen = unsafe { control.buf.len() };
195+
msg.msg_controllen = unsafe { control.buf.len() as _ };
196196
msg.msg_control = &mut control as *mut _ as *mut libc::c_void;
197197

198198
// SAFETY: A valid socket fd and a valid initialized msghdr are passed in.
@@ -208,7 +208,7 @@ fn receive_fd(rx_fd: UnixStream) -> RawFd {
208208
unsafe {
209209
let cmsgp = CMSG_FIRSTHDR(&msg);
210210
if cmsgp.is_null()
211-
|| (*cmsgp).cmsg_len != CMSG_LEN(size_of::<c_int>() as u32) as usize
211+
|| (*cmsgp).cmsg_len != CMSG_LEN(size_of::<c_int>() as u32) as _
212212
|| (*cmsgp).cmsg_level != SOL_SOCKET
213213
|| (*cmsgp).cmsg_type != SCM_RIGHTS
214214
{
@@ -235,15 +235,15 @@ fn send_fd(tx_fd: UnixStream, notify_fd: RawFd) -> io::Result<()> {
235235
// SAFETY: SingleRightAnciliaryData can be zero-initialized.
236236
let mut control: SingleRightAnciliaryData = unsafe { zeroed() };
237237
// SAFETY: The buf field is valid when zero-initialized.
238-
msg.msg_controllen = unsafe { control.buf.len() };
238+
msg.msg_controllen = unsafe { control.buf.len() as _ };
239239
msg.msg_control = &mut control as *mut _ as *mut _;
240240
// SAFETY: msg.msg_control is correctly initialized and this follows
241241
// the contract of the various CMSG_* macros.
242242
unsafe {
243243
let cmsgp = CMSG_FIRSTHDR(&msg);
244244
(*cmsgp).cmsg_level = SOL_SOCKET;
245245
(*cmsgp).cmsg_type = SCM_RIGHTS;
246-
(*cmsgp).cmsg_len = CMSG_LEN(size_of::<c_int>() as u32) as usize;
246+
(*cmsgp).cmsg_len = CMSG_LEN(size_of::<c_int>() as u32) as _;
247247
ptr::write(CMSG_DATA(cmsgp).cast::<c_int>(), notify_fd);
248248
}
249249

0 commit comments

Comments
 (0)