Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Unified Diff: ipc/ipc_channel_posix.cc

Issue 460102: Recognize EMSGSIZE as non-fatal on OS X. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/page_cycler/page_cycler_test.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_channel_posix.cc
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index 0d178d50ddef10c334ba06d3451de638205dcac1..435c572883b7c936c8b3ed41dd7e7106de3340fe 100644
--- a/ipc/ipc_channel_posix.cc
+++ b/ipc/ipc_channel_posix.cc
@@ -241,6 +241,17 @@ bool ClientConnectToFifo(const std::string &pipe_name, int* client_socket) {
return true;
}
+bool SocketWriteErrorIsRecoverable() {
+#if defined(OS_MACOSX)
+ // On OS X if sendmsg() is trying to send fds between processes and there
+ // isn't enough room in the output buffer to send the fd structure over
+ // atomically then EMSGSIZE is returned.
+ return errno == EAGAIN || errno == EMSGSIZE;
+#else
+ return errno == EAGAIN;
+#endif
+}
+
} // namespace
//------------------------------------------------------------------------------
@@ -815,7 +826,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
if (bytes_written > 0)
msg->file_descriptor_set()->CommitAll();
- if (bytes_written < 0 && errno != EAGAIN) {
+ if (bytes_written < 0 && !SocketWriteErrorIsRecoverable()) {
#if defined(OS_MACOSX)
// On OSX writing to a pipe with no listener returns EPERM.
if (errno == EPERM) {
@@ -830,13 +841,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
PLOG(ERROR) << "pipe error on "
<< fd_written
<< " Currently writing message of size:"
- << msg->size()
- << " msgh.msg_iovlen:"
- << msgh.msg_iovlen
- << " amt_to_write: "
- << amt_to_write
- << " num FDs to send:"
- << msg->file_descriptor_set()->size();
+ << msg->size();
return false;
}
« no previous file with comments | « chrome/test/page_cycler/page_cycler_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698