| 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 // For linux_syscall_support.h. This makes it safe to call embedded system | 5 // For linux_syscall_support.h. This makes it safe to call embedded system |
| 6 // calls when in seccomp mode. | 6 // calls when in seccomp mode. |
| 7 | 7 |
| 8 #include "chrome/app/breakpad_linux.h" | 8 #include "chrome/app/breakpad_linux.h" |
| 9 | 9 |
| 10 #include <fcntl.h> | 10 #include <fcntl.h> |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 msg.msg_iovlen = kCrashIovSize; | 818 msg.msg_iovlen = kCrashIovSize; |
| 819 char cmsg[kControlMsgSpaceSize]; | 819 char cmsg[kControlMsgSpaceSize]; |
| 820 my_memset(cmsg, 0, kControlMsgSpaceSize); | 820 my_memset(cmsg, 0, kControlMsgSpaceSize); |
| 821 msg.msg_control = cmsg; | 821 msg.msg_control = cmsg; |
| 822 msg.msg_controllen = sizeof(cmsg); | 822 msg.msg_controllen = sizeof(cmsg); |
| 823 | 823 |
| 824 struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); | 824 struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); |
| 825 hdr->cmsg_level = SOL_SOCKET; | 825 hdr->cmsg_level = SOL_SOCKET; |
| 826 hdr->cmsg_type = SCM_RIGHTS; | 826 hdr->cmsg_type = SCM_RIGHTS; |
| 827 hdr->cmsg_len = kControlMsgLenSize; | 827 hdr->cmsg_len = kControlMsgLenSize; |
| 828 ((int*) CMSG_DATA(hdr))[0] = fds[0]; | 828 memcpy(CMSG_DATA(hdr), fds, sizeof(fds)); |
| 829 ((int*) CMSG_DATA(hdr))[1] = fds[1]; | |
| 830 | 829 |
| 831 if (HANDLE_EINTR(sys_sendmsg(fd, &msg, 0)) < 0) { | 830 if (HANDLE_EINTR(sys_sendmsg(fd, &msg, 0)) < 0) { |
| 832 static const char errmsg[] = "Failed to tell parent about crash.\n"; | 831 static const char errmsg[] = "Failed to tell parent about crash.\n"; |
| 833 WriteLog(errmsg, sizeof(errmsg) - 1); | 832 WriteLog(errmsg, sizeof(errmsg) - 1); |
| 834 IGNORE_RET(sys_close(fds[1])); | 833 IGNORE_RET(sys_close(fds[1])); |
| 835 return false; | 834 return false; |
| 836 } | 835 } |
| 837 IGNORE_RET(sys_close(fds[1])); | 836 IGNORE_RET(sys_close(fds[1])); |
| 838 | 837 |
| 839 if (HANDLE_EINTR(sys_read(fds[0], &b, 1)) != 1) { | 838 if (HANDLE_EINTR(sys_read(fds[0], &b, 1)) != 1) { |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 } else { | 1707 } else { |
| 1709 EnableNonBrowserCrashDumping(minidump_fd); | 1708 EnableNonBrowserCrashDumping(minidump_fd); |
| 1710 } | 1709 } |
| 1711 } | 1710 } |
| 1712 } | 1711 } |
| 1713 #endif // OS_ANDROID | 1712 #endif // OS_ANDROID |
| 1714 | 1713 |
| 1715 bool IsCrashReporterEnabled() { | 1714 bool IsCrashReporterEnabled() { |
| 1716 return g_is_crash_reporter_enabled; | 1715 return g_is_crash_reporter_enabled; |
| 1717 } | 1716 } |
| OLD | NEW |