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 armv7 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 dd409cd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,18 @@ 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", target_arch = "arm"))]
{
mem::size_of::<sockaddr_storage>() as i32
}
#[cfg(not(all(target_os = "android", target_arch = "arm")))]
{
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 dd409cd

Please sign in to comment.