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

Unified Diff: chrome/nacl/nacl_helper_linux.cc

Issue 10695077: Better error reporting in nacl helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/nacl/nacl_helper_linux.cc
===================================================================
--- chrome/nacl/nacl_helper_linux.cc (revision 145264)
+++ chrome/nacl/nacl_helper_linux.cc (working copy)
@@ -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"
@@ -223,9 +224,11 @@
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
@@ -234,10 +237,9 @@
<< 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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698