Add `MSG_WAITFORONE.try_into().unwrap()` to deal with different type signature on musl libc (#29369)
* add try_into().unwrap() to deal with different type signature on musl libc * add allow useless_conversion * trailing whitespace * cargo fmt
This commit is contained in:
parent
8f4bcf7fee
commit
7d286961ba
|
@ -99,8 +99,17 @@ pub fn recv_mmsg(sock: &UdpSocket, packets: &mut [Packet]) -> io::Result</*num p
|
|||
tv_sec: 1,
|
||||
tv_nsec: 0,
|
||||
};
|
||||
let nrecv =
|
||||
unsafe { libc::recvmmsg(sock_fd, &mut hdrs[0], count as u32, MSG_WAITFORONE, &mut ts) };
|
||||
// TODO: remove .try_into().unwrap() once rust libc fixes recvmmsg types for musl
|
||||
#[allow(clippy::useless_conversion)]
|
||||
let nrecv = unsafe {
|
||||
libc::recvmmsg(
|
||||
sock_fd,
|
||||
&mut hdrs[0],
|
||||
count as u32,
|
||||
MSG_WAITFORONE.try_into().unwrap(),
|
||||
&mut ts,
|
||||
)
|
||||
};
|
||||
let nrecv = if nrecv < 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue