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

Side by Side Diff: chrome/browser/crash_handler_host_linux.cc

Issue 12091004: POSIX: re-enable strict aliasing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/breakpad_linux.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/crash_handler_host_linux.h" 5 #include "chrome/browser/crash_handler_host_linux.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/syscall.h> 10 #include <sys/syscall.h>
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 const unsigned num_fds = len / sizeof(int); 228 const unsigned num_fds = len / sizeof(int);
229 if (num_fds != 2) { 229 if (num_fds != 2) {
230 // A nasty process could try and send us too many descriptors and 230 // A nasty process could try and send us too many descriptors and
231 // force a leak. 231 // force a leak.
232 LOG(ERROR) << "Death signal contained wrong number of descriptors;" 232 LOG(ERROR) << "Death signal contained wrong number of descriptors;"
233 << " num_fds:" << num_fds; 233 << " num_fds:" << num_fds;
234 for (unsigned i = 0; i < num_fds; ++i) 234 for (unsigned i = 0; i < num_fds; ++i)
235 (void) HANDLE_EINTR(close(reinterpret_cast<int*>(CMSG_DATA(hdr))[i])); 235 (void) HANDLE_EINTR(close(reinterpret_cast<int*>(CMSG_DATA(hdr))[i]));
236 return; 236 return;
237 } else { 237 } else {
238 partner_fd = reinterpret_cast<int*>(CMSG_DATA(hdr))[0]; 238 int fds[2] = { -1, -1 };
Mark Mentovai 2013/08/15 14:29:07 Don’t initialize, the memcpy follows immediately.
Paweł Hajdan Jr. 2013/08/19 20:09:37 Done.
239 signal_fd = reinterpret_cast<int*>(CMSG_DATA(hdr))[1]; 239 memcpy(fds, CMSG_DATA(hdr), sizeof(fds));
240 partner_fd = fds[0];
241 signal_fd = fds[1];
240 } 242 }
241 } else if (hdr->cmsg_type == SCM_CREDENTIALS) { 243 } else if (hdr->cmsg_type == SCM_CREDENTIALS) {
242 const struct ucred *cred = 244 const struct ucred *cred =
243 reinterpret_cast<struct ucred*>(CMSG_DATA(hdr)); 245 reinterpret_cast<struct ucred*>(CMSG_DATA(hdr));
244 crashing_pid = cred->pid; 246 crashing_pid = cred->pid;
245 } 247 }
246 } 248 }
247 249
248 if (crashing_pid == -1 || partner_fd == -1 || signal_fd == -1) { 250 if (crashing_pid == -1 || partner_fd == -1 || signal_fd == -1) {
249 LOG(ERROR) << "Death signal message didn't contain all expected control" 251 LOG(ERROR) << "Death signal message didn't contain all expected control"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } 539 }
538 540
539 void RendererCrashHandlerHostLinux::SetProcessType() { 541 void RendererCrashHandlerHostLinux::SetProcessType() {
540 process_type_ = "renderer"; 542 process_type_ = "renderer";
541 } 543 }
542 544
543 // static 545 // static
544 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { 546 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() {
545 return Singleton<RendererCrashHandlerHostLinux>::get(); 547 return Singleton<RendererCrashHandlerHostLinux>::get();
546 } 548 }
OLDNEW
« no previous file with comments | « chrome/app/breakpad_linux.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698