[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 @@
|
|||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
|
target_os = "solaris",
|
||||||
|
target_os = "illumos",
|
||||||
target_os = "haiku",
|
target_os = "haiku",
|
||||||
target_os = "nto",
|
target_os = "nto",
|
||||||
))]
|
))]
|
||||||
@ -31,6 +33,8 @@
|
|||||||
target_os = "freebsd",
|
target_os = "freebsd",
|
||||||
target_os = "openbsd",
|
target_os = "openbsd",
|
||||||
target_os = "netbsd",
|
target_os = "netbsd",
|
||||||
|
target_os = "solaris",
|
||||||
|
target_os = "illumos",
|
||||||
target_os = "haiku",
|
target_os = "haiku",
|
||||||
target_os = "nto",
|
target_os = "nto",
|
||||||
)))]
|
)))]
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
target_os = "hurd",
|
target_os = "hurd",
|
||||||
target_os = "dragonfly", target_os = "freebsd",
|
target_os = "dragonfly", target_os = "freebsd",
|
||||||
target_os = "openbsd", target_os = "netbsd",
|
target_os = "openbsd", target_os = "netbsd",
|
||||||
|
target_os = "solaris", target_os = "illumos",
|
||||||
target_os = "haiku", target_os = "nto"))] {
|
target_os = "haiku", target_os = "nto"))] {
|
||||||
use libc::MSG_NOSIGNAL;
|
use libc::MSG_NOSIGNAL;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user