Skip to content

Commit 6d08187

Browse files
committed
Initialize in6_addr in a way that works for older Rust
1 parent f9b33b0 commit 6d08187

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/socket.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ fn addr2raw(addr: &SocketAddr) -> (SocketAddrCRepr, c::socklen_t) {
137137
}
138138
SocketAddr::V6(addr) => {
139139
#[cfg(unix)]
140-
let sin6_addr = c::in6_addr {
141-
s6_addr: addr.ip().octets(),
142-
..unsafe { mem::zeroed() }
140+
let sin6_addr = {
141+
let mut sin6_addr = unsafe { mem::zeroed::<c::in6_addr>() };
142+
sin6_addr.s6_addr = addr.ip().octets();
143+
sin6_addr
143144
};
144145
#[cfg(windows)]
145146
let sin6_addr = unsafe {

0 commit comments

Comments
 (0)