Skip to content

Commit

Permalink
Fix compilation on Haiku
Browse files Browse the repository at this point in the history
sin_len and sin6_len are apparently required on all BSD-like systems,
from which Haiku probably inherits its network stack.

sin_zero has been changed from 8 bytes to 24 bytes in hrev9079 in order
to stay compatible with BeOS.
  • Loading branch information
linkmauve authored and Thomasdezeeuw committed Nov 30, 2020
1 parent 7312f81 commit 3b4214d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sockaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,11 @@ impl From<SocketAddrV4> for SockAddr {
sin_family: AF_INET as sa_family_t,
sin_port: addr.port().to_be(),
sin_addr,
sin_zero: [0; 8],
sin_zero: Default::default(),
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -268,6 +269,7 @@ impl From<SocketAddrV6> for SockAddr {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down

0 comments on commit 3b4214d

Please sign in to comment.