diff options
author | halyavin@google.com <halyavin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 11:33:19 +0000 |
---|---|---|
committer | halyavin@google.com <halyavin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-11 11:33:19 +0000 |
commit | 943341b1a616e17ad9fdec1612c61ed9ab0514c3 (patch) | |
tree | d0a37241f68fbfddb758b4f7cee091bc5683dd13 /chrome/nacl | |
parent | 7c553d4f888592b1454a11bfca3f1383323ce558 (diff) | |
download | chromium_src-943341b1a616e17ad9fdec1612c61ed9ab0514c3.zip chromium_src-943341b1a616e17ad9fdec1612c61ed9ab0514c3.tar.gz chromium_src-943341b1a616e17ad9fdec1612c61ed9ab0514c3.tar.bz2 |
Better error reporting in nacl helper.
BUG= https://code.google.com/p/chromium/issues/detail?id=136793
TEST= none
Review URL: https://chromiumcodereview.appspot.com/10695077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/nacl')
-rw-r--r-- | chrome/nacl/nacl_helper_linux.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/chrome/nacl/nacl_helper_linux.cc b/chrome/nacl/nacl_helper_linux.cc index 11471e5..3c35c87 100644 --- a/chrome/nacl/nacl_helper_linux.cc +++ b/chrome/nacl/nacl_helper_linux.cc @@ -20,6 +20,7 @@ #include "base/command_line.h" #include "base/eintr_wrapper.h" #include "base/global_descriptors_posix.h" +#include "base/json/string_escape.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/posix/unix_domain_socket.h" @@ -235,9 +236,11 @@ int main(int argc, char *argv[]) { if (msglen == 0 || (msglen == -1 && errno == ECONNRESET)) { // EOF from the browser. Goodbye! _exit(0); - } - if (msglen == sizeof(kNaClForkRequest) - 1 && - memcmp(buf, kNaClForkRequest, msglen) == 0) { + } else if (msglen < 0) { + LOG(ERROR) << "nacl_helper: receive from zygote failed, errno = " + << errno; + } else if (msglen == sizeof(kNaClForkRequest) - 1 && + memcmp(buf, kNaClForkRequest, msglen) == 0) { if (kNaClParentFDIndex + 1 == fds.size()) { HandleForkRequest(fds, prereserved_sandbox_size); continue; // fork succeeded. Note: child does not return @@ -246,10 +249,9 @@ int main(int argc, char *argv[]) { << fds.size(); } } else { - if (msglen != 0) { - LOG(ERROR) << "nacl_helper unrecognized request: %s"; - _exit(-1); - } + LOG(ERROR) << "nacl_helper unrecognized request: " + << base::GetDoubleQuotedJson(std::string(buf, buf + msglen)); + _exit(-1); } // if fork fails, send PID=-1 to zygote if (!UnixDomainSocket::SendMsg(kNaClZygoteDescriptor, &badpid, |