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

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: Fix use of my_strlcat 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 size_t buf_len = my_strlen(dumpfile) + 10;
vapier 2014/10/13 22:37:55 alternative: const char kChromeFlag[] = "--chrom
stevefung 2014/10/13 23:51:54 Done.
975 char* chrome_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
976 chrome_flag[0] = '\0';
977 my_strlcat(chrome_flag, "--chrome=", buf_len);
978 my_strlcat(chrome_flag, dumpfile, buf_len);
979
980 buf_len = my_strlen(pid_buf) + 7;
981 char* pid_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
982 pid_flag[0] = '\0';
983 my_strlcat(pid_flag, "--pid=", buf_len);
984 my_strlcat(pid_flag, pid_buf, buf_len);
985
986 buf_len = my_strlen(uid_buf) + 7;
987 char* uid_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
988 uid_flag[0] = '\0';
989 my_strlcat(uid_flag, "--uid=", buf_len);
990 my_strlcat(uid_flag, uid_buf, buf_len);
991
992 buf_len = my_strlen(exe_buf) + 7;
993 char* exe_flag = reinterpret_cast<char*>(allocator->Alloc(buf_len));
994 exe_flag[0] = '\0';
995 my_strlcat(exe_flag, "--exe=", buf_len);
996 my_strlcat(exe_flag, exe_buf, buf_len);
997
973 const char* args[] = { 998 const char* args[] = {
974 kCrashReporterBinary, 999 kCrashReporterBinary,
975 "--chrome", 1000 chrome_flag,
976 dumpfile, 1001 pid_flag,
977 "--pid", 1002 uid_flag,
978 pid_buf, 1003 exe_flag,
979 "--uid",
980 uid_buf,
981 "--exe",
982 exe_buf,
983 NULL, 1004 NULL,
984 }; 1005 };
985 static const char msg[] = "Cannot upload crash dump: cannot exec " 1006 static const char msg[] = "Cannot upload crash dump: cannot exec "
986 "/sbin/crash_reporter\n"; 1007 "/sbin/crash_reporter\n";
987 #else 1008 #else
988 // The --header argument to wget looks like: 1009 // The --header argument to wget looks like:
989 // --header=Content-Type: multipart/form-data; boundary=XYZ 1010 // --header=Content-Type: multipart/form-data; boundary=XYZ
990 // where the boundary has two fewer leading '-' chars 1011 // where the boundary has two fewer leading '-' chars
991 static const char header_msg[] = 1012 static const char header_msg[] =
992 "--header=Content-Type: multipart/form-data; boundary="; 1013 "--header=Content-Type: multipart/form-data; boundary=";
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 } 1635 }
1615 } 1636 }
1616 } 1637 }
1617 #endif // OS_ANDROID 1638 #endif // OS_ANDROID
1618 1639
1619 bool IsCrashReporterEnabled() { 1640 bool IsCrashReporterEnabled() {
1620 return g_is_crash_reporter_enabled; 1641 return g_is_crash_reporter_enabled;
1621 } 1642 }
1622 1643
1623 } // namespace breakpad 1644 } // 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