Index: base/posix/unix_domain_socket_linux.cc |
diff --git a/base/posix/unix_domain_socket_linux.cc b/base/posix/unix_domain_socket_linux.cc |
index aaa7067f76fe2e7ed29ac9432402966a8045cf11..51b936ba45a28f7b6b095f2c626ae5cfb2a0d366 100644 |
--- a/base/posix/unix_domain_socket_linux.cc |
+++ b/base/posix/unix_domain_socket_linux.cc |
@@ -152,7 +152,13 @@ ssize_t UnixDomainSocket::RecvMsgWithFlags(int fd, |
} |
if (out_pid) { |
- DCHECK(pid != -1); |
+ // |pid| will legitimately be -1 if we read EOF, so only DCHECK if we |
+ // actually received a message. Unfortunately, Linux allows sending zero |
+ // length messages, which are indistinguishable from EOF, so this check |
+ // has false negatives. |
+ if (r > 0 || msg.msg_controllen > 0) |
+ DCHECK_GE(pid, 0); |
+ |
*out_pid = pid; |
} |