Skip to content

Commit 2ad5573

Browse files
authored
sys::socket fixes for haiku, illumos's cfg to solarish compound. (#2242)
1 parent 3b1ae36 commit 2ad5573

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

changelog/2242.fixed.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed UnixAddr::new for haiku, it did not record the `sun_len` value as needed.
2+
Fixed `sys::socket::addr::from_raw_parts` and `sys::socket::Sockaddrlike::len` build for solaris.

src/sys/socket/addr.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,7 @@ pub struct UnixAddr {
283283
/// The length of the valid part of `sun`, including the sun_family field
284284
/// but excluding any trailing nul.
285285
// On the BSDs, this field is built into sun
286-
#[cfg(any(
287-
linux_android,
288-
target_os = "fuchsia",
289-
target_os = "illumos",
290-
target_os = "redox",
291-
))]
286+
#[cfg(not(any(bsd, target_os = "haiku")))]
292287
sun_len: u8,
293288
}
294289

@@ -366,7 +361,7 @@ impl UnixAddr {
366361
.try_into()
367362
.unwrap();
368363

369-
#[cfg(bsd)]
364+
#[cfg(any(bsd, target_os = "haiku"))]
370365
{
371366
ret.sun_len = sun_len;
372367
}
@@ -447,7 +442,7 @@ impl UnixAddr {
447442
cfg_if! {
448443
if #[cfg(any(linux_android,
449444
target_os = "fuchsia",
450-
target_os = "illumos",
445+
solarish,
451446
target_os = "redox",
452447
))]
453448
{
@@ -525,7 +520,7 @@ impl UnixAddr {
525520

526521
impl private::SockaddrLikePriv for UnixAddr {}
527522
impl SockaddrLike for UnixAddr {
528-
#[cfg(any(linux_android, target_os = "fuchsia", target_os = "illumos"))]
523+
#[cfg(any(linux_android, target_os = "fuchsia", solarish, target_os = "redox"))]
529524
fn len(&self) -> libc::socklen_t {
530525
self.sun_len.into()
531526
}
@@ -2246,7 +2241,7 @@ mod tests {
22462241
#[cfg(any(
22472242
bsd,
22482243
target_os = "aix",
2249-
target_os = "illumos",
2244+
solarish,
22502245
target_os = "haiku"
22512246
))]
22522247
let l = mem::size_of::<libc::sockaddr_dl>();

src/sys/socket/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2373,7 +2373,7 @@ mod tests {
23732373
let _ = cmsg_space!(u8);
23742374
}
23752375

2376-
#[cfg(not(any(linux_android, target_os = "redox")))]
2376+
#[cfg(not(any(linux_android, target_os = "redox", target_os = "haiku")))]
23772377
#[test]
23782378
fn can_open_routing_socket() {
23792379
let _ = super::socket(

0 commit comments

Comments
 (0)