Chromium Code Reviews| Index: base/process/process_iterator_linux.cc |
| diff --git a/base/process/process_iterator_linux.cc b/base/process/process_iterator_linux.cc |
| index a9d044c53824f7cd74f1a1c9717a51f0fefc5dfb..e2d0123e3ca13fa6a98ee949de6d8486fdea6109 100644 |
| --- a/base/process/process_iterator_linux.cc |
| +++ b/base/process/process_iterator_linux.cc |
| @@ -59,18 +59,26 @@ bool GetProcCmdline(pid_t pid, std::vector<std::string>* proc_cmd_line_args) { |
| ProcessIterator::ProcessIterator(const ProcessFilter* filter) |
| : filter_(filter) { |
| procfs_dir_ = opendir(internal::kProcDir); |
| + if (!procfs_dir_) { |
|
Nico
2016/01/27 18:54:34
Can you add a comment when this can happen? From t
Robert Sesek
2016/01/27 18:58:42
Added a comment. This *shouldn't* happen every tim
Robert Sesek
2016/01/27 19:11:11
Filed https://code.google.com/p/chromium/issues/de
|
| + PLOG(ERROR) << "opendir " << internal::kProcDir; |
| + } |
| } |
| ProcessIterator::~ProcessIterator() { |
| if (procfs_dir_) { |
| closedir(procfs_dir_); |
| - procfs_dir_ = NULL; |
| + procfs_dir_ = nullptr; |
| } |
| } |
| bool ProcessIterator::CheckForNextProcess() { |
| // TODO(port): skip processes owned by different UID |
| + if (!procfs_dir_) { |
| + DLOG(ERROR) << "Skipping CheckForNextProcess(), no procfs_dir_"; |
| + return false; |
| + } |
| + |
| pid_t pid = kNullProcessId; |
| std::vector<std::string> cmd_line_args; |
| std::string stats_data; |