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

Unified Diff: base/process_util_linux.cc

Issue 10579050: Linux: Return a failure in ReadProcStats() if the stat file is empty. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_linux.cc
===================================================================
--- base/process_util_linux.cc (revision 142570)
+++ base/process_util_linux.cc (working copy)
@@ -48,7 +48,8 @@
VM_RSS = 23, // Resident Set Size in pages.
};
-// Reads /proc/<pid>/stat into |buffer|. Returns true if successful.
+// Reads /proc/<pid>/stat into |buffer|. Returns true if the file can be read
+// and is non-empty.
bool ReadProcStats(pid_t pid, std::string* buffer) {
buffer->clear();
// Synchronously reading files in /proc is safe.
@@ -59,7 +60,7 @@
DLOG(WARNING) << "Failed to get process stats.";
return false;
}
- return true;
+ return !buffer->empty();
}
// Takes |stats_data| and populates |proc_stats| with the values split by
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698