Skip to content

Commit e2dd181

Browse files
committed
Work around FreeBSD oddness
Should have expected that Darwin copied it from FreeBSD, but oh well.
1 parent efce8de commit e2dd181

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/sys/unix/uds/listener.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,9 @@ pub(crate) fn accept(listener: &net::UnixListener) -> io::Result<(UnixStream, So
100100

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

0 commit comments

Comments
 (0)