Skip to content

Fix dragonfly casting #1237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -804,26 +804,28 @@ f! {
}

pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + length as usize) as u32
}

pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
-> *mut ::cmsghdr
{
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
+ _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
+ _CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
let max = (*mhdr).msg_control as usize
+ (*mhdr).msg_controllen as usize;
if next <= max {
(cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
(
cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len as usize)
) as *mut ::cmsghdr
} else {
0 as *mut ::cmsghdr
}
}

pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
_CMSG_ALIGN(length as usize)
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
_CMSG_ALIGN(length as usize)) as u32
}
}

Expand Down