Skip to content

Commit 9a4e53f

Browse files
gibbz00tgross35
authored andcommitted
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. (backport <rust-lang#4903>) (cherry picked from commit 1e43edb)
1 parent d83e4bf commit 9a4e53f

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
@@ -80,21 +80,12 @@ mod t {
8080
if cfg!(target_os = "aix") && cmsg_len % std::mem::size_of::<cmsghdr>() != 0 {
8181
continue;
8282
}
83-
for next_cmsg_len in 0..32 {
84-
unsafe {
85-
pcmsghdr.cast::<u8>().write_bytes(0, CAPACITY);
86-
(*pcmsghdr).cmsg_len = cmsg_len as _;
87-
let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr);
88-
let next = cmsg_nxthdr(&mhdr, pcmsghdr);
89-
assert_eq!(libc_next, next);
90-
91-
if !libc_next.is_null() {
92-
(*libc_next).cmsg_len = next_cmsg_len;
93-
let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr);
94-
let next = cmsg_nxthdr(&mhdr, pcmsghdr);
95-
assert_eq!(libc_next, next);
96-
}
97-
}
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);
9889
}
9990
}
10091
}

0 commit comments

Comments
 (0)