Skip to content

Commit b73bfbe

Browse files
committed
Avoid deprecation warnings
These were added in libc 0.28.0; see rust-lang/libc#1703.
1 parent 5d2a8c2 commit b73bfbe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/sys/socket/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -847,12 +847,13 @@ impl<'a> ControlMessage<'a> {
847847
}
848848
#[cfg(any(target_os = "android", target_os = "linux"))]
849849
ControlMessage::AlgSetIv(iv) => {
850+
#[allow(deprecated)]
850851
let af_alg_iv = libc::af_alg_iv {
851852
ivlen: iv.len() as u32,
852853
iv: [0u8; 0],
853854
};
854855

855-
let size = mem::size_of::<libc::af_alg_iv>();
856+
let size = mem::size_of_val(&af_alg_iv);
856857

857858
unsafe {
858859
ptr::copy_nonoverlapping(
@@ -915,7 +916,7 @@ impl<'a> ControlMessage<'a> {
915916
}
916917
#[cfg(any(target_os = "android", target_os = "linux"))]
917918
ControlMessage::AlgSetIv(iv) => {
918-
mem::size_of::<libc::af_alg_iv>() + iv.len()
919+
mem::size_of_val(&iv) + iv.len()
919920
},
920921
#[cfg(any(target_os = "android", target_os = "linux"))]
921922
ControlMessage::AlgSetOp(op) => {

0 commit comments

Comments
 (0)