We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9f598d2 commit f54e564Copy full SHA for f54e564
libc-test/tests/cmsg.rs
@@ -30,13 +30,14 @@ mod t {
30
31
#[test]
32
fn test_cmsg_firsthdr() {
33
+ let mut buf = [0u8; 256];
34
let mut mhdr: msghdr = unsafe { mem::zeroed() };
- mhdr.msg_control = 0xdeadbeef as *mut c_void;
35
- let pmhdr = &mhdr as *const msghdr;
+ mhdr.msg_control = buf.as_mut_ptr().cast::<c_void>();
36
+
37
for l in 0..128 {
- mhdr.msg_controllen = l;
38
+ mhdr.msg_controllen = l as _;
39
unsafe {
- assert_eq!(libc::CMSG_FIRSTHDR(pmhdr), cmsg_firsthdr(pmhdr));
40
+ assert_eq!(libc::CMSG_FIRSTHDR(&mhdr), cmsg_firsthdr(&mhdr));
41
}
42
43
0 commit comments