about summary refs log tree commit diff
path: root/src/libstd/sys/unix
diff options
context:
space:
mode:
authorMathieu Poumeyrol <mathieu.poumeyrol@snips.ai>2016-09-28 14:06:34 +0200
committerMathieu Poumeyrol <mathieu.poumeyrol@snips.ai>2016-09-28 19:44:20 +0200
commit5980d5bfddb8f1e92cee7f9a156c4758615bee4b (patch)
tree022065e6a10d078382de69cb35812ea742b15c61 /src/libstd/sys/unix
parented5e5428192f6f72afcb4becc3d78a18133613df (diff)
downloadrust-5980d5bfddb8f1e92cee7f9a156c4758615bee4b.tar.gz
rust-5980d5bfddb8f1e92cee7f9a156c4758615bee4b.zip
use MSG_NOSIGNAL from liblibc
Diffstat (limited to 'src/libstd/sys/unix')
-rw-r--r--src/libstd/sys/unix/ext/net.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs
index f2e40714b46..03ff8d9787f 100644
--- a/src/libstd/sys/unix/ext/net.rs
+++ b/src/libstd/sys/unix/ext/net.rs
@@ -29,7 +29,7 @@ use sys::net::Socket;
 use sys_common::{AsInner, FromInner, IntoInner};
 
 #[cfg(target_os = "linux")]
-const MSG_NOSIGNAL: libc::c_int = 0x4000;
+use libc::MSG_NOSIGNAL;
 #[cfg(not(target_os = "linux"))]
 const MSG_NOSIGNAL: libc::c_int = 0x0; // unused dummy value
 
@@ -691,12 +691,11 @@ impl UnixDatagram {
         fn inner(d: &UnixDatagram, buf: &[u8], path: &Path) -> io::Result<usize> {
             unsafe {
                 let (addr, len) = sockaddr_un(path)?;
-                let flags = if cfg!(target_os = "linux") { MSG_NOSIGNAL } else { 0 };
 
                 let count = cvt(libc::sendto(*d.0.as_inner(),
                                              buf.as_ptr() as *const _,
                                              buf.len(),
-                                             flags,
+                                             MSG_NOSIGNAL,
                                              &addr as *const _ as *const _,
                                              len))?;
                 Ok(count as usize)