Skip to content

Commit

Permalink
Work around FreeBSD oddness
Browse files Browse the repository at this point in the history
Should have expected that Darwin copied it from FreeBSD, but oh well.
  • Loading branch information
Thomasdezeeuw committed Jun 9, 2024
1 parent efce8de commit e2dd181
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/sys/unix/uds/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,9 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So

#[allow(unused_mut)] // See below.
let mut path_len = socklen as usize - path_offset(&sockaddr);
// Darwin is being weird, it returns a length of 16, but an unnamed (all
// On FreeBSD and Darwin, it returns a length of 14/16, but an unnamed (all
// zero) address. Map that to a length of 0 to match other OS.
#[cfg(any(
target_os = "ios",
target_os = "macos",
target_os = "tvos",
target_os = "watchos",
))]
if socklen == 16 && sockaddr.sun_path[0] == 0 {
if sockaddr.sun_path[0] == 0 {
path_len = 0;
}
let address = SocketAddr::from_pathname(Path::new(OsStr::from_bytes(unsafe {
Expand Down

0 comments on commit e2dd181

Please sign in to comment.