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; |
} |