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..95275c29abff7c966c24810df4bfd1bc3b28322a 100644 |
--- a/base/process/process_iterator_linux.cc |
+++ b/base/process/process_iterator_linux.cc |
@@ -59,18 +59,28 @@ 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_) { |
+ // On Android, SELinux may prevent reading /proc. See |
+ // https://crbug.com/581517 for details. |
+ 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; |