Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/render_sandbox_host_linux.h" | 5 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #include <sys/uio.h> | 9 #include <sys/uio.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 // The other side of this call is in zygote_main_linux.cc | 289 // The other side of this call is in zygote_main_linux.cc |
| 290 | 290 |
| 291 std::string time_string; | 291 std::string time_string; |
| 292 if (!pickle.ReadString(&iter, &time_string) || | 292 if (!pickle.ReadString(&iter, &time_string) || |
| 293 time_string.size() != sizeof(time_t)) { | 293 time_string.size() != sizeof(time_t)) { |
| 294 return; | 294 return; |
| 295 } | 295 } |
| 296 | 296 |
| 297 time_t time; | 297 time_t time; |
| 298 memcpy(&time, time_string.data(), sizeof(time)); | 298 memcpy(&time, time_string.data(), sizeof(time)); |
| 299 struct tm expanded_time; | 299 // We use localtime here because we need the tm_zone field to be filled |
| 300 localtime_r(&time, &expanded_time); | 300 // out. Since we are a single-threaded process, this is safe. |
| 301 const struct tm* expanded_time = localtime(&time); | |
| 301 | 302 |
| 302 const std::string result_string(reinterpret_cast<char*>(&expanded_time), | 303 const std::string result_string(reinterpret_cast<const char*>(expanded_time) , |
|
tony
2009/07/22 20:01:41
Nit: 80 cols.
| |
| 303 sizeof(expanded_time)); | 304 sizeof(struct tm)); |
| 304 | 305 |
| 305 Pickle reply; | 306 Pickle reply; |
| 306 reply.WriteString(result_string); | 307 reply.WriteString(result_string); |
| 308 reply.WriteString(expanded_time->tm_zone); | |
| 307 SendRendererReply(fds, reply, -1); | 309 SendRendererReply(fds, reply, -1); |
| 308 } | 310 } |
| 309 | 311 |
| 310 void SendRendererReply(const std::vector<int>& fds, const Pickle& reply, | 312 void SendRendererReply(const std::vector<int>& fds, const Pickle& reply, |
| 311 int reply_fd) { | 313 int reply_fd) { |
| 312 struct msghdr msg; | 314 struct msghdr msg; |
| 313 memset(&msg, 0, sizeof(msg)); | 315 memset(&msg, 0, sizeof(msg)); |
| 314 struct iovec iov = {const_cast<void*>(reply.data()), reply.size()}; | 316 struct iovec iov = {const_cast<void*>(reply.data()), reply.size()}; |
| 315 msg.msg_iov = &iov; | 317 msg.msg_iov = &iov; |
| 316 msg.msg_iovlen = 1; | 318 msg.msg_iovlen = 1; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 SandboxIPCProcess handler(child_lifeline_fd, browser_socket); | 362 SandboxIPCProcess handler(child_lifeline_fd, browser_socket); |
| 361 handler.Run(); | 363 handler.Run(); |
| 362 _exit(0); | 364 _exit(0); |
| 363 } | 365 } |
| 364 } | 366 } |
| 365 | 367 |
| 366 RenderSandboxHostLinux::~RenderSandboxHostLinux() { | 368 RenderSandboxHostLinux::~RenderSandboxHostLinux() { |
| 367 HANDLE_EINTR(close(renderer_socket_)); | 369 HANDLE_EINTR(close(renderer_socket_)); |
| 368 HANDLE_EINTR(close(childs_lifeline_fd_)); | 370 HANDLE_EINTR(close(childs_lifeline_fd_)); |
| 369 } | 371 } |
| OLD | NEW |