-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
C-bugCategory: bugCategory: bug
Description
PR #1098 introduced Rust functions that duplicate the CMSG_FIRSTHDR
, CMSG_NXTHDR
, CMSG_DATA
, CMSG_SPACE
, and CMSG_LEN
C macros. However, several of these are incorrect on BSD. It looks like the author wrote the Linux versions first, and then simply copied them into src/unix/bsd/mod.rs. For example, on both FreeBSD and OpenBSD CMSG_DATA
is defined as
pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
cmsg.offset(1) as *mut ::c_uchar
}
even though the actual C macro is
#define CMSG_DATA(cmsg) \
((unsigned char *)(cmsg) + _ALIGN(sizeof(struct cmsghdr)))
gnzlbg
Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug