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

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 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 const unsigned num_fds = len / sizeof(int); 223 const unsigned num_fds = len / sizeof(int);
224 if (num_fds != 2) { 224 if (num_fds != 2) {
225 // A nasty process could try and send us too many descriptors and 225 // A nasty process could try and send us too many descriptors and
226 // force a leak. 226 // force a leak.
227 LOG(ERROR) << "Death signal contained wrong number of descriptors;" 227 LOG(ERROR) << "Death signal contained wrong number of descriptors;"
228 << " num_fds:" << num_fds; 228 << " num_fds:" << num_fds;
229 for (unsigned i = 0; i < num_fds; ++i) 229 for (unsigned i = 0; i < num_fds; ++i)
230 (void) HANDLE_EINTR(close(reinterpret_cast<int*>(CMSG_DATA(hdr))[i])); 230 (void) HANDLE_EINTR(close(reinterpret_cast<int*>(CMSG_DATA(hdr))[i]));
231 return; 231 return;
232 } else { 232 } else {
233 partner_fd = reinterpret_cast<int*>(CMSG_DATA(hdr))[0]; 233 int fds[2];
234 signal_fd = reinterpret_cast<int*>(CMSG_DATA(hdr))[1]; 234 memcpy(fds, CMSG_DATA(hdr), sizeof(fds));
235 partner_fd = fds[0];
236 signal_fd = fds[1];
235 } 237 }
236 } else if (hdr->cmsg_type == SCM_CREDENTIALS) { 238 } else if (hdr->cmsg_type == SCM_CREDENTIALS) {
237 const struct ucred *cred = 239 const struct ucred *cred =
238 reinterpret_cast<struct ucred*>(CMSG_DATA(hdr)); 240 reinterpret_cast<struct ucred*>(CMSG_DATA(hdr));
239 crashing_pid = cred->pid; 241 crashing_pid = cred->pid;
240 } 242 }
241 } 243 }
242 244
243 if (crashing_pid == -1 || partner_fd == -1 || signal_fd == -1) { 245 if (crashing_pid == -1 || partner_fd == -1 || signal_fd == -1) {
244 LOG(ERROR) << "Death signal message didn't contain all expected control" 246 LOG(ERROR) << "Death signal message didn't contain all expected control"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 } 531 }
530 532
531 void RendererCrashHandlerHostLinux::SetProcessType() { 533 void RendererCrashHandlerHostLinux::SetProcessType() {
532 process_type_ = "renderer"; 534 process_type_ = "renderer";
533 } 535 }
534 536
535 // static 537 // static
536 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { 538 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() {
537 return Singleton<RendererCrashHandlerHostLinux>::get(); 539 return Singleton<RendererCrashHandlerHostLinux>::get();
538 } 540 }
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