Skip to content

Commit

Permalink
Initialize in6_addr in a way that works for older Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Nov 7, 2020
1 parent f9b33b0 commit 6d08187
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/socket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ fn addr2raw(addr: &SocketAddr) -> (SocketAddrCRepr, c::socklen_t) {
}
SocketAddr::V6(addr) => {
#[cfg(unix)]
let sin6_addr = c::in6_addr {
s6_addr: addr.ip().octets(),
..unsafe { mem::zeroed() }
let sin6_addr = {
let mut sin6_addr = unsafe { mem::zeroed::<c::in6_addr>() };
sin6_addr.s6_addr = addr.ip().octets();
sin6_addr
};
#[cfg(windows)]
let sin6_addr = unsafe {
Expand Down

0 comments on commit 6d08187

Please sign in to comment.