From dd409cd2c3e9565404db18b4cc151c92ee381183 Mon Sep 17 00:00:00 2001 From: Tuetuopay Date: Thu, 8 Feb 2024 19:38:13 +0100 Subject: [PATCH] unix: fix recv_multiple_from on 32-bit android For some braindead reason, old versions of android on armv7 defined socklen_t to be an int, instead of the unsigned int it was everywhere else. --- src/sys/unix.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sys/unix.rs b/src/sys/unix.rs index 148e2c9d..10cc87c3 100644 --- a/src/sys/unix.rs +++ b/src/sys/unix.rs @@ -1099,7 +1099,18 @@ pub(crate) fn recv_multiple_from( flags: c_int, ) -> io::Result> { let mut addrs = (0..msgs.len()) - .map(|_| unsafe { SockAddr::new(mem::zeroed(), mem::size_of::() as u32) }) + .map(|_| unsafe { + SockAddr::new(mem::zeroed(), { + #[cfg(all(target_os = "android", target_arch = "arm"))] + { + mem::size_of::() as i32 + } + #[cfg(not(all(target_os = "android", target_arch = "arm")))] + { + mem::size_of::() as u32 + } + }) + }) .collect::>(); let mut msgs = MmsgHdrMut::new(msgs.len()) .with_buffers(msgs)