From 14f9cbdfd596390e039a7af8ca3003662fecc28e Mon Sep 17 00:00:00 2001 From: Mathieu Poumeyrol Date: Sun, 9 Oct 2016 13:01:29 +0200 Subject: [PATCH] use MSG_NOSIGNAL on all relevant platforms --- src/liblibc | 2 +- src/libstd/sys/common/net.rs | 12 +++++++++--- src/libstd/sys/unix/ext/net.rs | 12 +++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/liblibc b/src/liblibc index b474785561d58..5a17b4a733a22 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit b474785561d58efbd27add9d22339dcabad742ad +Subproject commit 5a17b4a733a22d445fdd63326f826fcd8a584328 diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 74a46fce403aa..10ad61f4c800c 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -42,10 +42,16 @@ use sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; target_os = "solaris", target_os = "haiku")))] use sys::net::netc::IPV6_DROP_MEMBERSHIP; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android", + target_os = "dragonfly", target_os = "freebsd", + target_os = "openbsd", target_os = "netbsd", + target_os = "haiku", target_os = "bitrig"))] use libc::MSG_NOSIGNAL; -#[cfg(not(target_os = "linux"))] -const MSG_NOSIGNAL: c_int = 0x0; // unused dummy value +#[cfg(not(any(target_os = "linux", target_os = "android", + target_os = "dragonfly", target_os = "freebsd", + target_os = "openbsd", target_os = "netbsd", + target_os = "haiku", target_os = "bitrig")))] +const MSG_NOSIGNAL: c_int = 0x0; //////////////////////////////////////////////////////////////////////////////// // sockaddr and misc bindings diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs index 622fd4b85a59a..80f53da1cefe0 100644 --- a/src/libstd/sys/unix/ext/net.rs +++ b/src/libstd/sys/unix/ext/net.rs @@ -28,10 +28,16 @@ use sys::cvt; use sys::net::Socket; use sys_common::{AsInner, FromInner, IntoInner}; -#[cfg(target_os = "linux")] +#[cfg(any(target_os = "linux", target_os = "android", + target_os = "dragonfly", target_os = "freebsd", + target_os = "openbsd", target_os = "netbsd", + target_os = "haiku", target_os = "bitrig"))] use libc::MSG_NOSIGNAL; -#[cfg(not(target_os = "linux"))] -const MSG_NOSIGNAL: libc::c_int = 0x0; // unused dummy value +#[cfg(not(any(target_os = "linux", target_os = "android", + target_os = "dragonfly", target_os = "freebsd", + target_os = "openbsd", target_os = "netbsd", + target_os = "haiku", target_os = "bitrig")))] +const MSG_NOSIGNAL: libc::c_int = 0x0; fn sun_path_offset() -> usize { unsafe {