Skip to content

Commit

Permalink
unix: fix recv_multiple_from on 32-bit android
Browse files Browse the repository at this point in the history
For some braindead reason, old versions of android on 32 bit  defined
socklen_t to be an int, instead of the unsigned int it was everywhere
else.
  • Loading branch information
Tuetuopay committed Feb 8, 2024
1 parent d297957 commit 15dd43d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/sys/unix.rs
Expand Up @@ -1099,7 +1099,21 @@ pub(crate) fn recv_multiple_from(
flags: c_int,
) -> io::Result<Vec<(usize, RecvFlags, SockAddr)>> {
let mut addrs = (0..msgs.len())
.map(|_| unsafe { SockAddr::new(mem::zeroed(), mem::size_of::<sockaddr_storage>() as u32) })
.map(|_| unsafe {
SockAddr::new(mem::zeroed(), {
#[cfg(all(target_os = "android", any(target_arch = "arm", target_arch = "x86")))]
{
mem::size_of::<sockaddr_storage>() as i32
}
#[cfg(not(all(
target_os = "android",
any(target_arch = "arm", target_arch = "x86")
)))]
{
mem::size_of::<sockaddr_storage>() as u32
}
})
})
.collect::<Vec<_>>();
let mut msgs = MmsgHdrMut::new(msgs.len())
.with_buffers(msgs)
Expand Down

0 comments on commit 15dd43d

Please sign in to comment.