Skip to content

Commit 7a878ea

Browse files
committed
std::net: Socket::new_raw no set to SO_NOSIGPIPE on freebsd.
1 parent 91d5e4a commit 7a878ea

File tree

1 file changed

+2
-3
lines changed
  • library/std/src/sys/pal/unix

1 file changed

+2
-3
lines changed

library/std/src/sys/pal/unix/net.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ impl Socket {
7474
if #[cfg(any(
7575
target_os = "android",
7676
target_os = "dragonfly",
77-
target_os = "freebsd",
7877
target_os = "illumos",
7978
target_os = "hurd",
8079
target_os = "linux",
@@ -93,9 +92,9 @@ impl Socket {
9392
fd.set_cloexec()?;
9493
let socket = Socket(fd);
9594

96-
// macOS and iOS use `SO_NOSIGPIPE` as a `setsockopt`
95+
// macOS, iOS and FreeBSD use `SO_NOSIGPIPE` as a `setsockopt`
9796
// flag to disable `SIGPIPE` emission on socket.
98-
#[cfg(target_vendor = "apple")]
97+
#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
9998
setsockopt(&socket, libc::SOL_SOCKET, libc::SO_NOSIGPIPE, 1)?;
10099

101100
Ok(socket)

0 commit comments

Comments
 (0)