mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
[illumos/solaris] set MSG_NOSIGNAL while writing to sockets
Both these platforms have MSG_NOSIGNAL available, and we should set it for socket writes in the event that the SIGPIPE handler has been reset to SIG_DFL (i.e. terminate the process). I've verified via a quick program at https://github.com/sunshowers/msg-nosignal-test/ that even when the SIGPIPE handler is reset to SIG_DFL, writes to closed sockets now error out with EPIPE. (Under ordinary circumstances UDP writes won't cause MSG_NOSIGNAL.)
This commit is contained in:
parent
2d5a628a1d
commit
50d127e6ec
@ -20,6 +20,8 @@ use crate::{fmt, io};
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
target_os = "haiku",
|
||||
target_os = "nto",
|
||||
))]
|
||||
@ -31,6 +33,8 @@ use libc::MSG_NOSIGNAL;
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
target_os = "haiku",
|
||||
target_os = "nto",
|
||||
)))]
|
||||
|
@ -42,6 +42,7 @@ cfg_if::cfg_if! {
|
||||
target_os = "hurd",
|
||||
target_os = "dragonfly", target_os = "freebsd",
|
||||
target_os = "openbsd", target_os = "netbsd",
|
||||
target_os = "solaris", target_os = "illumos",
|
||||
target_os = "haiku", target_os = "nto"))] {
|
||||
use libc::MSG_NOSIGNAL;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user