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_main.h" | 5 #include "content/zygote/zygote_main.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <pthread.h> | 9 #include <pthread.h> |
10 #include <signal.h> | 10 #include <signal.h> |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 GetSandboxFD(), reply_buf, sizeof(reply_buf), NULL, | 127 GetSandboxFD(), reply_buf, sizeof(reply_buf), NULL, |
128 request); | 128 request); |
129 if (r == -1) { | 129 if (r == -1) { |
130 memset(output, 0, sizeof(struct tm)); | 130 memset(output, 0, sizeof(struct tm)); |
131 return; | 131 return; |
132 } | 132 } |
133 | 133 |
134 Pickle reply(reinterpret_cast<char*>(reply_buf), r); | 134 Pickle reply(reinterpret_cast<char*>(reply_buf), r); |
135 PickleIterator iter(reply); | 135 PickleIterator iter(reply); |
136 std::string result, timezone; | 136 std::string result, timezone; |
137 if (!reply.ReadString(&iter, &result) || | 137 if (!iter.ReadString(&result) || |
138 !reply.ReadString(&iter, &timezone) || | 138 !iter.ReadString(&timezone) || |
139 result.size() != sizeof(struct tm)) { | 139 result.size() != sizeof(struct tm)) { |
140 memset(output, 0, sizeof(struct tm)); | 140 memset(output, 0, sizeof(struct tm)); |
141 return; | 141 return; |
142 } | 142 } |
143 | 143 |
144 memcpy(output, result.data(), sizeof(struct tm)); | 144 memcpy(output, result.data(), sizeof(struct tm)); |
145 if (timezone_out_len) { | 145 if (timezone_out_len) { |
146 const size_t copy_len = std::min(timezone_out_len - 1, timezone.size()); | 146 const size_t copy_len = std::min(timezone_out_len - 1, timezone.size()); |
147 memcpy(timezone_out, timezone.data(), copy_len); | 147 memcpy(timezone_out, timezone.data(), copy_len); |
148 timezone_out[copy_len] = 0; | 148 timezone_out[copy_len] = 0; |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 bool setuid_sandbox_engaged = sandbox_flags & kSandboxLinuxSUID; | 635 bool setuid_sandbox_engaged = sandbox_flags & kSandboxLinuxSUID; |
636 CHECK_EQ(must_enable_setuid_sandbox, setuid_sandbox_engaged); | 636 CHECK_EQ(must_enable_setuid_sandbox, setuid_sandbox_engaged); |
637 | 637 |
638 Zygote zygote(sandbox_flags, fork_delegates.Pass(), extra_children, | 638 Zygote zygote(sandbox_flags, fork_delegates.Pass(), extra_children, |
639 extra_fds); | 639 extra_fds); |
640 // This function call can return multiple times, once per fork(). | 640 // This function call can return multiple times, once per fork(). |
641 return zygote.ProcessRequests(); | 641 return zygote.ProcessRequests(); |
642 } | 642 } |
643 | 643 |
644 } // namespace content | 644 } // namespace content |
OLD | NEW |