Skip to content

Commit c7b3a6a

Browse files
committed
Only test addresses of cmsghdrs that are multiples of the size of cmsghdr.
1 parent ca7a33d commit c7b3a6a

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

libc-test/tests/cmsg.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,7 @@ mod t {
66

77
use std::mem;
88

9-
use libc::{
10-
self,
11-
c_uchar,
12-
c_uint,
13-
c_void,
14-
cmsghdr,
15-
msghdr,
16-
};
9+
use libc::{self, c_uchar, c_uint, c_void, cmsghdr, msghdr};
1710

1811
extern "C" {
1912
pub fn cmsg_firsthdr(msgh: *const msghdr) -> *mut cmsghdr;
@@ -73,6 +66,14 @@ mod t {
7366
mhdr.msg_controllen = (160 - trunc) as _;
7467

7568
for cmsg_payload_len in 0..64 {
69+
// AIX does not apply any alignment or padding to ancillary
70+
// data and CMSG_ALIGN() is a noop. So only test addresses
71+
// that are multiples of the size of cmsghdr here.
72+
if cfg!(target_os = "aix") && cmsg_payload_len % std::mem::size_of::<cmsghdr>() != 0
73+
{
74+
continue;
75+
}
76+
7677
let mut current_cmsghdr_ptr = pcmsghdr;
7778
assert!(!current_cmsghdr_ptr.is_null());
7879
let mut count = 0;

0 commit comments

Comments
 (0)