summaryrefslogtreecommitdiffstats
path: root/base/posix
diff options
context:
space:
mode:
authorjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 07:46:55 +0000
committerjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 07:46:55 +0000
commit6608ddc171309529cc976a87acb81c37399b2b3f (patch)
tree5c49d36258ab2f640a0655b48a123d9fe48ba4af /base/posix
parentca5ac4b2a444da8251753c5bf4ac72c7adbe081c (diff)
downloadchromium_src-6608ddc171309529cc976a87acb81c37399b2b3f.zip
chromium_src-6608ddc171309529cc976a87acb81c37399b2b3f.tar.gz
chromium_src-6608ddc171309529cc976a87acb81c37399b2b3f.tar.bz2
Linux sandbox: add a new low-level broker process mechanism.
We add a new low-level broker process mechanism that can be async signal safe and is suitable for use in the seccomp-bpf sandbox. Also fix UnixDomainSocket::SendMsg() to never generate a SIGPIPE. This is a re-land of https://chromiumcodereview.appspot.com/11557025/ (173064) BUG=165837 TBR=markus,willchan NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11564030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173128 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/posix')
-rw-r--r--base/posix/unix_domain_socket.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/base/posix/unix_domain_socket.cc b/base/posix/unix_domain_socket.cc
index 730657d..5bfcef1 100644
--- a/base/posix/unix_domain_socket.cc
+++ b/base/posix/unix_domain_socket.cc
@@ -43,7 +43,14 @@ bool UnixDomainSocket::SendMsg(int fd,
msg.msg_controllen = cmsg->cmsg_len;
}
- const ssize_t r = HANDLE_EINTR(sendmsg(fd, &msg, 0));
+ // When available, take advantage of MSG_NOSIGNAL to avoid
+ // a SIGPIPE if the other end breaks the connection.
+#if defined(MSG_NOSIGNAL)
+ const int flags = MSG_NOSIGNAL;
+#else
+ const int flags = 0;
+#endif
+ const ssize_t r = HANDLE_EINTR(sendmsg(fd, &msg, flags));
const bool ret = static_cast<ssize_t>(length) == r;
delete[] control_buffer;
return ret;