Skip to content

Commit

Permalink
init msghdr with zeros via MaybeUninit::zeroed to cover private paddi…
Browse files Browse the repository at this point in the history
…ng for musl (#33)
  • Loading branch information
agend authored Aug 21, 2020
1 parent 31e4f2f commit ddd3ee7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/io_uring/in_flight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,11 @@ impl InFlight {
size
]);
let msghdrs = UnsafeCell::new(vec![
libc::msghdr {
msg_name: null_mut(),
msg_namelen: std::mem::size_of::<
libc::sockaddr_in,
>() as u32,
msg_iov: null_mut(),
msg_iovlen: 1,
msg_control: null_mut(),
msg_controllen: 0,
msg_flags: 0,
};
#[allow(unsafe_code)]
unsafe { MaybeUninit::<libc::msghdr>::zeroed().assume_init() };
size
]);

let mut filler_vec = Vec::with_capacity(size);
for _ in 0..size {
filler_vec.push(None);
Expand Down Expand Up @@ -71,6 +63,7 @@ impl InFlight {
(*iovec_ptr)
.as_mut_ptr()
.add(ticket);
(*msghdr_ptr)[ticket].msg_iovlen = 1;
}
}
(*self.fillers.get())[ticket] = Some(filler);
Expand Down
1 change: 1 addition & 0 deletions src/io_uring/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::{
},
Arc, Condvar, Mutex,
},
mem::MaybeUninit
};

use super::{
Expand Down

0 comments on commit ddd3ee7

Please sign in to comment.