diff --git a/library/std/src/sys/pal/unix/net.rs b/library/std/src/sys/pal/unix/net.rs index 7237989c9059b..702f5f1938e73 100644 --- a/library/std/src/sys/pal/unix/net.rs +++ b/library/std/src/sys/pal/unix/net.rs @@ -74,7 +74,6 @@ impl Socket { if #[cfg(any( target_os = "android", target_os = "dragonfly", - target_os = "freebsd", target_os = "illumos", target_os = "hurd", target_os = "linux", @@ -93,9 +92,9 @@ impl Socket { fd.set_cloexec()?; let socket = Socket(fd); - // macOS and iOS use `SO_NOSIGPIPE` as a `setsockopt` + // macOS, iOS and FreeBSD use `SO_NOSIGPIPE` as a `setsockopt` // flag to disable `SIGPIPE` emission on socket. - #[cfg(target_vendor = "apple")] + #[cfg(any(target_vendor = "apple", target_os = "freebsd"))] setsockopt(&socket, libc::SOL_SOCKET, libc::SO_NOSIGPIPE, 1)?; Ok(socket)