OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/zygote/zygote_linux.h" | 5 #include "content/zygote/zygote_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return true; | 121 return true; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 bool Zygote::UsingSUIDSandbox() const { | 125 bool Zygote::UsingSUIDSandbox() const { |
126 return sandbox_flags_ & kSandboxLinuxSUID; | 126 return sandbox_flags_ & kSandboxLinuxSUID; |
127 } | 127 } |
128 | 128 |
129 bool Zygote::HandleRequestFromBrowser(int fd) { | 129 bool Zygote::HandleRequestFromBrowser(int fd) { |
130 std::vector<int> fds; | 130 std::vector<int> fds; |
131 static const unsigned kMaxMessageLength = 2048; | 131 char buf[kZygoteMaxMessageLength]; |
132 char buf[kMaxMessageLength]; | |
133 const ssize_t len = UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds); | 132 const ssize_t len = UnixDomainSocket::RecvMsg(fd, buf, sizeof(buf), &fds); |
134 | 133 |
135 if (len == 0 || (len == -1 && errno == ECONNRESET)) { | 134 if (len == 0 || (len == -1 && errno == ECONNRESET)) { |
136 // EOF from the browser. We should die. | 135 // EOF from the browser. We should die. |
137 _exit(0); | 136 _exit(0); |
138 return false; | 137 return false; |
139 } | 138 } |
140 | 139 |
141 if (len == -1) { | 140 if (len == -1) { |
142 PLOG(ERROR) << "Error reading message from browser"; | 141 PLOG(ERROR) << "Error reading message from browser"; |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 PickleIterator iter) { | 490 PickleIterator iter) { |
492 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != | 491 if (HANDLE_EINTR(write(fd, &sandbox_flags_, sizeof(sandbox_flags_))) != |
493 sizeof(sandbox_flags_)) { | 492 sizeof(sandbox_flags_)) { |
494 PLOG(ERROR) << "write"; | 493 PLOG(ERROR) << "write"; |
495 } | 494 } |
496 | 495 |
497 return false; | 496 return false; |
498 } | 497 } |
499 | 498 |
500 } // namespace content | 499 } // namespace content |
OLD | NEW |