Skip to content

Commit 8131774

Browse files
committed
std::net: Socket::new_raw set to SO_NOSIGPIPE on freebsd/netbsd/dragonfly.
1 parent 91d5e4a commit 8131774

File tree

1 file changed

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

1 file changed

+2
-5
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ impl Socket {
7373
cfg_if::cfg_if! {
7474
if #[cfg(any(
7575
target_os = "android",
76-
target_os = "dragonfly",
77-
target_os = "freebsd",
7876
target_os = "illumos",
7977
target_os = "hurd",
8078
target_os = "linux",
81-
target_os = "netbsd",
8279
target_os = "openbsd",
8380
target_os = "nto",
8481
))] {
@@ -93,9 +90,9 @@ impl Socket {
9390
fd.set_cloexec()?;
9491
let socket = Socket(fd);
9592

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

10198
Ok(socket)

0 commit comments

Comments
 (0)