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

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: 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
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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 version.c_str(), 403 version.c_str(),
404 payload_path.c_str(), 404 payload_path.c_str(),
405 payload_size); 405 payload_size);
406 // We must use WriteNewFile instead of file_util::WriteFile as we 406 // 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 407 // do not want to write with root access to a symlink that an attacker
408 // might have created. 408 // might have created.
409 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) {
410 logger_->LogError("Unable to write %s", meta_path.value().c_str()); 410 logger_->LogError("Unable to write %s", meta_path.value().c_str());
411 } 411 }
412 } 412 }
413
414 bool
415 CrashCollector::IsOfficialBuild() {
416 std::map<std::string, std::string> contents;
417 if (!ReadKeyValueFile(FilePath(std::string(lsb_release_)), '=', &contents)) {
418 logger_->LogError("Problem parsing %s", lsb_release_);
419 // Even though there was some failure, take as much as we could read.
420 }
421 std::string version_description("unknown");
422 std::map<std::string, std::string>::iterator i;
423 if ((i = contents.find("CHROMEOS_VERSION_DESCRIPTION")) != contents.end()) {
424 version_description = i->second;
425 }
426
427 return (version_description.find("Official") != std::string::npos);
428 }
429
430 bool CrashCollector::IsCrashTestInProgress() {
kmixter1 2011/02/23 04:49:02 Use file_util::PathExists.
thieule 2011/02/23 21:03:04 Done.
431 struct stat statbuf;
432 return (stat("/tmp/crash-test-in-progress", &statbuf) == 0);
433 }
OLDNEW
« no previous file with comments | « crash_collector.h ('k') | user_collector.cc » ('j') | user_collector.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698