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

Side by Side Diff: crash_collector.cc

Issue 6297004: crash-reporter: Add diagnostics to help diagnose failures in the wild (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git@master
Patch Set: respond to review Created 9 years, 10 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 | « crash_collector.h ('k') | crash_collector_test.cc » ('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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 "crash-reporter/crash_collector.h" 5 #include "crash-reporter/crash_collector.h"
6 6
7 #include <dirent.h> 7 #include <dirent.h>
8 #include <fcntl.h> // For file creation modes. 8 #include <fcntl.h> // For file creation modes.
9 #include <pwd.h> // For struct passwd. 9 #include <pwd.h> // For struct passwd.
10 #include <sys/types.h> // for mode_t. 10 #include <sys/types.h> // for mode_t.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 argv[arguments.size()] = NULL; 104 argv[arguments.size()] = NULL;
105 105
106 int pid = fork(); 106 int pid = fork();
107 if (pid < 0) { 107 if (pid < 0) {
108 logger_->LogError("Fork failed: %d", errno); 108 logger_->LogError("Fork failed: %d", errno);
109 return -1; 109 return -1;
110 } 110 }
111 111
112 if (pid == 0) { 112 if (pid == 0) {
113 int output_handle = HANDLE_EINTR(creat(output_file, 0600)); 113 int output_handle = HANDLE_EINTR(
114 open(output_file, O_CREAT | O_WRONLY | O_TRUNC | O_EXCL, 0666));
114 if (output_handle < 0) { 115 if (output_handle < 0) {
115 logger_->LogError("Could not create %s: %d", output_file, errno); 116 logger_->LogError("Could not create %s: %d", output_file, errno);
116 // Avoid exit() to avoid atexit handlers from parent. 117 // Avoid exit() to avoid atexit handlers from parent.
117 _exit(127); 118 _exit(127);
118 } 119 }
119 dup2(output_handle, 1); 120 dup2(output_handle, 1);
120 dup2(output_handle, 2); 121 dup2(output_handle, 2);
121 execv(argv[0], &argv[0]); 122 execv(argv[0], &argv[0]);
122 logger_->LogError("Exec failed: %d", errno); 123 logger_->LogError("Exec failed: %d", errno);
123 _exit(127); 124 _exit(127);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 version.c_str(), 403 version.c_str(),
403 payload_path.c_str(), 404 payload_path.c_str(),
404 payload_size); 405 payload_size);
405 // We must use WriteNewFile instead of file_util::WriteFile as we 406 // We must use WriteNewFile instead of file_util::WriteFile as we
406 // do not want to write with root access to a symlink that an attacker 407 // do not want to write with root access to a symlink that an attacker
407 // might have created. 408 // might have created.
408 if (WriteNewFile(meta_path, meta_data.c_str(), meta_data.size()) < 0) { 409 if (WriteNewFile(meta_path, meta_data.c_str(), meta_data.size()) < 0) {
409 logger_->LogError("Unable to write %s", meta_path.value().c_str()); 410 logger_->LogError("Unable to write %s", meta_path.value().c_str());
410 } 411 }
411 } 412 }
OLDNEW
« no previous file with comments | « crash_collector.h ('k') | crash_collector_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698