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

Side by Side Diff: crash_collector.cc

Issue 6559003: Modify crash-reporter to collect crash information for unofficial builds. (Closed) Base URL: http://git.chromium.org/git/crash-reporter.git@master
Patch Set: Address code review feedbacks 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') | user_collector.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.
11 #include <sys/wait.h> // For waitpid. 11 #include <sys/wait.h> // For waitpid.
12 #include <unistd.h> // For execv and fork. 12 #include <unistd.h> // For execv and fork.
13 13
14 #include <set> 14 #include <set>
15 15
16 #include "base/eintr_wrapper.h" 16 #include "base/eintr_wrapper.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "crash-reporter/system_logging.h" 20 #include "crash-reporter/system_logging.h"
21 21
22 static const char kDefaultUserName[] = "chronos"; 22 static const char kDefaultUserName[] = "chronos";
23 static const char kLsbRelease[] = "/etc/lsb-release"; 23 static const char kLsbRelease[] = "/etc/lsb-release";
24 static const char kShellPath[] = "/bin/sh"; 24 static const char kShellPath[] = "/bin/sh";
25 static const char kSystemCrashPath[] = "/var/spool/crash"; 25 static const char kSystemCrashPath[] = "/var/spool/crash";
26 static const char kUserCrashPath[] = "/home/chronos/user/crash"; 26 static const char kUserCrashPath[] = "/home/chronos/user/crash";
27 static const char kCrashTestInProgressPath[] = "/tmp/crash-test-in-progress";
27 28
28 // Directory mode of the user crash spool directory. 29 // Directory mode of the user crash spool directory.
29 static const mode_t kUserCrashPathMode = 0755; 30 static const mode_t kUserCrashPathMode = 0755;
30 31
31 // Directory mode of the system crash spool directory. 32 // Directory mode of the system crash spool directory.
32 static const mode_t kSystemCrashPathMode = 01755; 33 static const mode_t kSystemCrashPathMode = 01755;
33 34
34 static const uid_t kRootOwner = 0; 35 static const uid_t kRootOwner = 0;
35 static const uid_t kRootGroup = 0; 36 static const uid_t kRootGroup = 0;
36 37
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 version.c_str(), 404 version.c_str(),
404 payload_path.c_str(), 405 payload_path.c_str(),
405 payload_size); 406 payload_size);
406 // We must use WriteNewFile instead of file_util::WriteFile as we 407 // We must use WriteNewFile instead of file_util::WriteFile as we
407 // do not want to write with root access to a symlink that an attacker 408 // do not want to write with root access to a symlink that an attacker
408 // might have created. 409 // might have created.
409 if (WriteNewFile(meta_path, meta_data.c_str(), meta_data.size()) < 0) { 410 if (WriteNewFile(meta_path, meta_data.c_str(), meta_data.size()) < 0) {
410 logger_->LogError("Unable to write %s", meta_path.value().c_str()); 411 logger_->LogError("Unable to write %s", meta_path.value().c_str());
411 } 412 }
412 } 413 }
414
415 bool CrashCollector::IsCrashTestInProgress() {
416 return file_util::PathExists(FilePath(kCrashTestInProgressPath));
417 }
OLDNEW
« no previous file with comments | « crash_collector.h ('k') | user_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698