From 7a878ea08bb549493b5e1cea22e0816410ed6b11 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 28 Apr 2024 13:50:11 +0100 Subject: [PATCH] std::net: Socket::new_raw no set to SO_NOSIGPIPE on freebsd. --- library/std/src/sys/pal/unix/net.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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)