summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 08:15:05 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-10 08:15:05 +0000
commitb47461bd96be9ca7c3a39a7ef1d767cab966bdc5 (patch)
treeebff797db017beac2725dd02854d6b40a60421de
parentcef7c5267a3ae0618c4f7dfde61587a1f5addb6d (diff)
downloadchromium_src-b47461bd96be9ca7c3a39a7ef1d767cab966bdc5.zip
chromium_src-b47461bd96be9ca7c3a39a7ef1d767cab966bdc5.tar.gz
chromium_src-b47461bd96be9ca7c3a39a7ef1d767cab966bdc5.tar.bz2
POSIX: fix logging of messages with file descriptors
Sometimes the IPC Message logging code parses the message multiple times. When we have a side array of FileDescriptors, this fails because the array is consumed by the first parse and so the second parse fails - causing a DCHECK failure. Although we could write a system to all the side array to be parsed multiple times, this code is only enabled in debugging mode and the only advantage would be that we could log the actual descriptor numbers. It doesn't appear that the performance hit would be worthwhile. Thus, we make hitting the end of the descriptor array a non-fatal error. The returned descriptor will be -1. Since we have the number of descriptors in the message header, the only case where this could mask an actual issue would be where the browser and renderer disagree on the structure of a given message. However, such a mismatch will probably cause much more grevious errors anyway. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9472 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/ipc_message_utils.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index 7887dcc..bd38df0 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -681,13 +681,17 @@ struct ParamTraits<FileDescriptor> {
r->auto_close = false;
r->fd = m->descriptor_set()->NextDescriptor();
- return r->fd >= 0;
+ // We always return true here because some of the IPC message logging
+ // functions want to parse the message multiple times. On the second and
+ // later attempts, the descriptor_set will be empty and so will return -1,
+ // however, failing to parse at log time is a fatal error.
+ return true;
}
static void Log(const param_type& p, std::wstring* l) {
if (p.auto_close) {
- l->append(StringPrintf(L"FD(%d auto-close)", p.fd));
+ l->append(L"FD(auto-close)");
} else {
- l->append(StringPrintf(L"FD(%d)", p.fd));
+ l->append(L"FD");
}
}
};