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

Unified Diff: base/process_util_linux.cc

Issue 5286010: Start using file_util symlink code, now that it's available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review change Created 10 years, 1 month 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 | « base/file_util_posix.cc ('k') | chrome/browser/process_singleton_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_linux.cc
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index 6138c07e876a55a194a1bcc56f42c3d2d54665cf..4627aa598d3e18cd0ed937dfd0d5211db27f6dd3 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -111,13 +111,12 @@ FilePath GetProcessExecutablePath(ProcessHandle process) {
FilePath stat_file("/proc");
stat_file = stat_file.Append(base::IntToString(process));
stat_file = stat_file.Append("exe");
- char exename[2048];
- ssize_t len = readlink(stat_file.value().c_str(), exename, sizeof(exename));
- if (len < 1) {
+ FilePath exe_name;
+ if (!file_util::ReadSymbolicLink(stat_file, &exe_name)) {
// No such process. Happens frequently in e.g. TerminateAllChromeProcesses
return FilePath();
}
- return FilePath(std::string(exename, len));
+ return exe_name;
}
ProcessIterator::ProcessIterator(const ProcessFilter* filter)
« no previous file with comments | « base/file_util_posix.cc ('k') | chrome/browser/process_singleton_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698