diff --git a/changelog/2242.fixed.md b/changelog/2242.fixed.md new file mode 100644 index 0000000000..c5194db5fa --- /dev/null +++ b/changelog/2242.fixed.md @@ -0,0 +1,2 @@ +Fixed UnixAddr::new for haiku, it did not record the `sun_len` value as needed. +Fixed `sys::socket::addr::from_raw_parts` and `sys::socket::Sockaddrlike::len` build for solaris. diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 2c2058b24d..a446f7454b 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -283,12 +283,7 @@ pub struct UnixAddr { /// The length of the valid part of `sun`, including the sun_family field /// but excluding any trailing nul. // On the BSDs, this field is built into sun - #[cfg(any( - linux_android, - target_os = "fuchsia", - target_os = "illumos", - target_os = "redox", - ))] + #[cfg(not(any(bsd, target_os = "haiku")))] sun_len: u8, } @@ -366,7 +361,7 @@ impl UnixAddr { .try_into() .unwrap(); - #[cfg(bsd)] + #[cfg(any(bsd, target_os = "haiku"))] { ret.sun_len = sun_len; } @@ -447,7 +442,7 @@ impl UnixAddr { cfg_if! { if #[cfg(any(linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "redox", ))] { @@ -525,7 +520,7 @@ impl UnixAddr { impl private::SockaddrLikePriv for UnixAddr {} impl SockaddrLike for UnixAddr { - #[cfg(any(linux_android, target_os = "fuchsia", target_os = "illumos"))] + #[cfg(any(linux_android, target_os = "fuchsia", solarish, target_os = "redox"))] fn len(&self) -> libc::socklen_t { self.sun_len.into() } @@ -2246,7 +2241,7 @@ mod tests { #[cfg(any( bsd, target_os = "aix", - target_os = "illumos", + solarish, target_os = "haiku" ))] let l = mem::size_of::(); diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index 50b87fbf98..a37e123616 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -2373,7 +2373,7 @@ mod tests { let _ = cmsg_space!(u8); } - #[cfg(not(any(linux_android, target_os = "redox")))] + #[cfg(not(any(linux_android, target_os = "redox", target_os = "haiku")))] #[test] fn can_open_routing_socket() { let _ = super::socket(