OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "crash/user_collector.h" | 10 #include "crash/user_collector.h" |
(...skipping 39 matching lines...) Loading... |
50 return "core"; | 50 return "core"; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 bool UserCollector::SetUpInternal(bool enabled) { | 54 bool UserCollector::SetUpInternal(bool enabled) { |
55 CHECK(initialized_); | 55 CHECK(initialized_); |
56 logger_->LogInfo("%s crash handling", enabled ? "Enabling" : "Disabling"); | 56 logger_->LogInfo("%s crash handling", enabled ? "Enabling" : "Disabling"); |
57 std::string pattern = GetPattern(enabled); | 57 std::string pattern = GetPattern(enabled); |
58 if (file_util::WriteFile(FilePath(core_pattern_file_), | 58 if (file_util::WriteFile(FilePath(core_pattern_file_), |
59 pattern.c_str(), | 59 pattern.c_str(), |
60 pattern.length()) != pattern.length()) { | 60 pattern.length()) != |
| 61 static_cast<int>(pattern.length())) { |
61 logger_->LogError("Unable to write %s", core_pattern_file_.c_str()); | 62 logger_->LogError("Unable to write %s", core_pattern_file_.c_str()); |
62 return false; | 63 return false; |
63 } | 64 } |
64 return true; | 65 return true; |
65 } | 66 } |
66 | 67 |
67 void UserCollector::HandleCrash(int signal, int pid, const std::string &exec) { | 68 void UserCollector::HandleCrash(int signal, int pid, const std::string &exec) { |
68 CHECK(initialized_); | 69 CHECK(initialized_); |
69 logger_->LogWarning("Received crash notification for %s[%d] sig %d", | 70 logger_->LogWarning("Received crash notification for %s[%d] sig %d", |
70 exec.c_str(), pid, signal); | 71 exec.c_str(), pid, signal); |
71 | 72 |
72 if (is_feedback_allowed_function_()) { | 73 if (is_feedback_allowed_function_()) { |
73 count_crash_function_(); | 74 count_crash_function_(); |
74 } | 75 } |
75 } | 76 } |
OLD | NEW |