Skip to content

Commit 78b269b

Browse files
authored
net: fix UdpSocket sendMsg (#264)
Fixes bug as found in #263
1 parent 47fbddf commit 78b269b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/io/sendmsg.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub(crate) struct SendMsg<T, U> {
1313
_io_slices: Vec<IoSlice<'static>>,
1414
_socket_addr: Option<Box<SockAddr>>,
1515
msg_control: Option<U>,
16-
msghdr: libc::msghdr,
16+
msghdr: Box<libc::msghdr>,
1717
}
1818

1919
impl<T: BoundedBuf, U: BoundedBuf> Op<SendMsg<T, U>> {
@@ -25,7 +25,7 @@ impl<T: BoundedBuf, U: BoundedBuf> Op<SendMsg<T, U>> {
2525
) -> io::Result<Self> {
2626
use io_uring::{opcode, types};
2727

28-
let mut msghdr: libc::msghdr = unsafe { std::mem::zeroed() };
28+
let mut msghdr: Box<libc::msghdr> = Box::new(unsafe { std::mem::zeroed() });
2929

3030
let mut io_slices: Vec<IoSlice<'static>> = Vec::with_capacity(io_bufs.len());
3131

@@ -76,7 +76,7 @@ impl<T: BoundedBuf, U: BoundedBuf> Op<SendMsg<T, U>> {
7676
|sendmsg| {
7777
opcode::SendMsg::new(
7878
types::Fd(sendmsg._fd.raw_fd()),
79-
&sendmsg.msghdr as *const _,
79+
&*sendmsg.msghdr as *const _,
8080
)
8181
.build()
8282
},

0 commit comments

Comments
 (0)