| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "chromecast/crash/linux/synchronized_minidump_manager.h" | 5 #include "chromecast/crash/linux/synchronized_minidump_manager.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <grp.h> | 10 #include <grp.h> |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 std::ifstream in(lockfile_path_); | 146 std::ifstream in(lockfile_path_); |
| 147 if (!in.is_open()) { | 147 if (!in.is_open()) { |
| 148 NOTREACHED(); | 148 NOTREACHED(); |
| 149 LOG(ERROR) << lockfile_path_ << " could not be opened."; | 149 LOG(ERROR) << lockfile_path_ << " could not be opened."; |
| 150 return -1; | 150 return -1; |
| 151 } | 151 } |
| 152 | 152 |
| 153 // Grab each entry. | 153 // Grab each entry. |
| 154 while (std::getline(in, entry)) { | 154 while (std::getline(in, entry)) { |
| 155 scoped_ptr<DumpInfo> info(new DumpInfo(entry)); | 155 scoped_ptr<DumpInfo> info(new DumpInfo(entry)); |
| 156 if (info->valid() && info->crashed_process_dump().size() > 0) | 156 if (info->valid() && info->crashed_process_dump().size() > 0) { |
| 157 dumps->push_back(info.Pass()); | 157 dumps->push_back(info.Pass()); |
| 158 else | 158 } else { |
| 159 LOG(WARNING) << "Ignoring invalid entry: " << entry; | 159 LOG(WARNING) << "Entry is not valid: " << entry; |
| 160 return -1; |
| 161 } |
| 160 } | 162 } |
| 161 | 163 |
| 162 dump_metadata_ = dumps.Pass(); | 164 dump_metadata_ = dumps.Pass(); |
| 163 return 0; | 165 return 0; |
| 164 } | 166 } |
| 165 | 167 |
| 166 int SynchronizedMinidumpManager::AddEntryToLockFile(const DumpInfo& dump_info) { | 168 int SynchronizedMinidumpManager::AddEntryToLockFile(const DumpInfo& dump_info) { |
| 167 DCHECK_LE(0, lockfile_fd_); | 169 DCHECK_LE(0, lockfile_fd_); |
| 168 | 170 |
| 169 // Make sure dump_info is valid. | 171 // Make sure dump_info is valid. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 close(lockfile_fd_); | 210 close(lockfile_fd_); |
| 209 | 211 |
| 210 // We may use this object again, so we should reset this. | 212 // We may use this object again, so we should reset this. |
| 211 lockfile_fd_ = -1; | 213 lockfile_fd_ = -1; |
| 212 } | 214 } |
| 213 | 215 |
| 214 dump_metadata_.reset(); | 216 dump_metadata_.reset(); |
| 215 } | 217 } |
| 216 | 218 |
| 217 } // namespace chromecast | 219 } // namespace chromecast |
| OLD | NEW |