Skip to content

Commit d1d545a

Browse files
committed
Remove redundant CMSG_NXTHDR test assertions.
Likely written to make assertions in the unsound CMSG_NXTHDR implementations introduced in rust-lang#1235. CMSG_NXTHDR(mhdr, current_cmsghdr) should not be concerned with the value next_cmsghdr.cmsg_len, which the previous implementation did.
1 parent ee5a187 commit d1d545a

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

libc-test/tests/cmsg.rs

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,12 @@ mod t {
7979
if cfg!(target_os = "aix") && cmsg_len % std::mem::size_of::<cmsghdr>() != 0 {
8080
continue;
8181
}
82-
for next_cmsg_len in 0..32 {
83-
unsafe {
84-
pcmsghdr.cast::<u8>().write_bytes(0, CAPACITY);
85-
(*pcmsghdr).cmsg_len = cmsg_len as _;
86-
let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr);
87-
let next = cmsg_nxthdr(&mhdr, pcmsghdr);
88-
assert_eq!(libc_next, next);
89-
90-
if !libc_next.is_null() {
91-
(*libc_next).cmsg_len = next_cmsg_len;
92-
let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr);
93-
let next = cmsg_nxthdr(&mhdr, pcmsghdr);
94-
assert_eq!(libc_next, next);
95-
}
96-
}
82+
unsafe {
83+
pcmsghdr.cast::<u8>().write_bytes(0, CAPACITY);
84+
(*pcmsghdr).cmsg_len = cmsg_len as _;
85+
let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr);
86+
let next = cmsg_nxthdr(&mhdr, pcmsghdr);
87+
assert_eq!(libc_next, next);
9788
}
9889
}
9990
}

0 commit comments

Comments
 (0)