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

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

Issue 649443002: Breakpad Linux: Fix flag value delimiter for ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove hardcoded size constants Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/crash/app/breakpad_linux.h" 8 #include "components/crash/app/breakpad_linux.h"
9 9
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 char pid_buf[kUint64StringSize]; 963 char pid_buf[kUint64StringSize];
964 uint64_t pid_str_length = my_uint64_len(info.pid); 964 uint64_t pid_str_length = my_uint64_len(info.pid);
965 my_uint64tos(pid_buf, info.pid, pid_str_length); 965 my_uint64tos(pid_buf, info.pid, pid_str_length);
966 pid_buf[pid_str_length] = '\0'; 966 pid_buf[pid_str_length] = '\0';
967 967
968 char uid_buf[kUint64StringSize]; 968 char uid_buf[kUint64StringSize];
969 uid_t uid = geteuid(); 969 uid_t uid = geteuid();
970 uint64_t uid_str_length = my_uint64_len(uid); 970 uint64_t uid_str_length = my_uint64_len(uid);
971 my_uint64tos(uid_buf, uid, uid_str_length); 971 my_uint64tos(uid_buf, uid, uid_str_length);
972 uid_buf[uid_str_length] = '\0'; 972 uid_buf[uid_str_length] = '\0';
973
974 const char kChromeFlag[] = "--chrome=";
975 size_t buf_len = my_strlen(dumpfile) + sizeof(kChromeFlag);
976 char* chrome_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
977 chrome_flag[0] = '\0';
978 my_strlcat(chrome_flag, kChromeFlag, buf_len);
979 my_strlcat(chrome_flag, dumpfile, buf_len);
980
981 const char kPidFlag[] = "--pid=";
982 buf_len = my_strlen(pid_buf) + sizeof(kPidFlag);
983 char* pid_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
984 pid_flag[0] = '\0';
985 my_strlcat(pid_flag, kPidFlag, buf_len);
986 my_strlcat(pid_flag, pid_buf, buf_len);
987
988 const char kUidFlag[] = "--uid=";
989 buf_len = my_strlen(uid_buf) + sizeof(kUidFlag);
990 char* uid_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
991 uid_flag[0] = '\0';
992 my_strlcat(uid_flag, kUidFlag, buf_len);
993 my_strlcat(uid_flag, uid_buf, buf_len);
994
995 const char kExeBuf[] = "--exe=";
996 buf_len = my_strlen(exe_buf) + sizeof(kExeBuf);
997 char* exe_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
998 exe_flag[0] = '\0';
999 my_strlcat(exe_flag, kExeBuf, buf_len);
1000 my_strlcat(exe_flag, exe_buf, buf_len);
1001
973 const char* args[] = { 1002 const char* args[] = {
974 kCrashReporterBinary, 1003 kCrashReporterBinary,
975 "--chrome", 1004 chrome_flag,
976 dumpfile, 1005 pid_flag,
977 "--pid", 1006 uid_flag,
978 pid_buf, 1007 exe_flag,
979 "--uid",
980 uid_buf,
981 "--exe",
982 exe_buf,
983 NULL, 1008 NULL,
984 }; 1009 };
985 static const char msg[] = "Cannot upload crash dump: cannot exec " 1010 static const char msg[] = "Cannot upload crash dump: cannot exec "
986 "/sbin/crash_reporter\n"; 1011 "/sbin/crash_reporter\n";
987 #else 1012 #else
988 // The --header argument to wget looks like: 1013 // The --header argument to wget looks like:
989 // --header=Content-Type: multipart/form-data; boundary=XYZ 1014 // --header=Content-Type: multipart/form-data; boundary=XYZ
990 // where the boundary has two fewer leading '-' chars 1015 // where the boundary has two fewer leading '-' chars
991 static const char header_msg[] = 1016 static const char header_msg[] =
992 "--header=Content-Type: multipart/form-data; boundary="; 1017 "--header=Content-Type: multipart/form-data; boundary=";
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1639 }
1615 } 1640 }
1616 } 1641 }
1617 #endif // OS_ANDROID 1642 #endif // OS_ANDROID
1618 1643
1619 bool IsCrashReporterEnabled() { 1644 bool IsCrashReporterEnabled() {
1620 return g_is_crash_reporter_enabled; 1645 return g_is_crash_reporter_enabled;
1621 } 1646 }
1622 1647
1623 } // namespace breakpad 1648 } // namespace breakpad
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698