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

Side by Side Diff: components/breakpad/app/breakpad_linux.cc

Issue 283643004: Remove SCM_CREDENTIALS fallback code from breakpad (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/breakpad/app/breakpad_linux.h" 8 #include "components/breakpad/app/breakpad_linux.h"
9 9
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 // Start constructing the message to send to the browser. 790 // Start constructing the message to send to the browser.
791 char distro[kDistroSize + 1] = {0}; 791 char distro[kDistroSize + 1] = {0};
792 PopulateDistro(distro, NULL); 792 PopulateDistro(distro, NULL);
793 793
794 char b; // Dummy variable for sys_read below. 794 char b; // Dummy variable for sys_read below.
795 const char* b_addr = &b; // Get the address of |b| so we can create the 795 const char* b_addr = &b; // Get the address of |b| so we can create the
796 // expected /proc/[pid]/syscall content in the 796 // expected /proc/[pid]/syscall content in the
797 // browser to convert namespace tids. 797 // browser to convert namespace tids.
798 798
799 // The length of the control message: 799 // The length of the control message:
800 static const unsigned kControlMsgSize = sizeof(fds); 800 static const unsigned kControlMsgSize = sizeof(int);
801 static const unsigned kControlMsgSpaceSize = CMSG_SPACE(kControlMsgSize); 801 static const unsigned kControlMsgSpaceSize = CMSG_SPACE(kControlMsgSize);
802 static const unsigned kControlMsgLenSize = CMSG_LEN(kControlMsgSize); 802 static const unsigned kControlMsgLenSize = CMSG_LEN(kControlMsgSize);
803 803
804 struct kernel_msghdr msg; 804 struct kernel_msghdr msg;
805 my_memset(&msg, 0, sizeof(struct kernel_msghdr)); 805 my_memset(&msg, 0, sizeof(struct kernel_msghdr));
806 struct kernel_iovec iov[kCrashIovSize]; 806 struct kernel_iovec iov[kCrashIovSize];
807 iov[0].iov_base = const_cast<void*>(crash_context); 807 iov[0].iov_base = const_cast<void*>(crash_context);
808 iov[0].iov_len = crash_context_size; 808 iov[0].iov_len = crash_context_size;
809 iov[1].iov_base = distro; 809 iov[1].iov_base = distro;
810 iov[1].iov_len = kDistroSize + 1; 810 iov[1].iov_len = kDistroSize + 1;
(...skipping 19 matching lines...) Expand all
830 msg.msg_iovlen = kCrashIovSize; 830 msg.msg_iovlen = kCrashIovSize;
831 char cmsg[kControlMsgSpaceSize]; 831 char cmsg[kControlMsgSpaceSize];
832 my_memset(cmsg, 0, kControlMsgSpaceSize); 832 my_memset(cmsg, 0, kControlMsgSpaceSize);
833 msg.msg_control = cmsg; 833 msg.msg_control = cmsg;
834 msg.msg_controllen = sizeof(cmsg); 834 msg.msg_controllen = sizeof(cmsg);
835 835
836 struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); 836 struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg);
837 hdr->cmsg_level = SOL_SOCKET; 837 hdr->cmsg_level = SOL_SOCKET;
838 hdr->cmsg_type = SCM_RIGHTS; 838 hdr->cmsg_type = SCM_RIGHTS;
839 hdr->cmsg_len = kControlMsgLenSize; 839 hdr->cmsg_len = kControlMsgLenSize;
840 ((int*) CMSG_DATA(hdr))[0] = fds[0]; 840 ((int*)CMSG_DATA(hdr))[0] = fds[1];
841 ((int*) CMSG_DATA(hdr))[1] = fds[1];
842 841
843 if (HANDLE_EINTR(sys_sendmsg(server_fd_, &msg, 0)) < 0) { 842 if (HANDLE_EINTR(sys_sendmsg(server_fd_, &msg, 0)) < 0) {
844 static const char errmsg[] = "Failed to tell parent about crash.\n"; 843 static const char errmsg[] = "Failed to tell parent about crash.\n";
845 WriteLog(errmsg, sizeof(errmsg) - 1); 844 WriteLog(errmsg, sizeof(errmsg) - 1);
846 IGNORE_RET(sys_close(fds[1])); 845 IGNORE_RET(sys_close(fds[1]));
847 return false; 846 return false;
848 } 847 }
849 IGNORE_RET(sys_close(fds[1])); 848 IGNORE_RET(sys_close(fds[1]));
850 849
851 if (HANDLE_EINTR(sys_read(fds[0], &b, 1)) != 1) { 850 if (HANDLE_EINTR(sys_read(fds[0], &b, 1)) != 1) {
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 } 1626 }
1628 } 1627 }
1629 } 1628 }
1630 #endif // OS_ANDROID 1629 #endif // OS_ANDROID
1631 1630
1632 bool IsCrashReporterEnabled() { 1631 bool IsCrashReporterEnabled() {
1633 return g_is_crash_reporter_enabled; 1632 return g_is_crash_reporter_enabled;
1634 } 1633 }
1635 1634
1636 } // namespace breakpad 1635 } // namespace breakpad
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698