From 723571af3c1a86aa14a68bce2511f3dad399287f Mon Sep 17 00:00:00 2001 From: "gspencer@chromium.org" Date: Fri, 3 Dec 2010 17:37:54 +0000 Subject: Start using file_util symlink code, now that it's available. In CL http://codereview.chromium.org/5349007 I added some base API for manipulating symlinks (since I needed it for some ChromeOS code and noticed that other places could use it too), and this just starts using that API. BUG=none TEST=Ran ui_tests, passed trybots. Review URL: http://codereview.chromium.org/5286010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68181 0039d316-1c4b-4281-b951-d872f2087c98 --- base/process_util_linux.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'base/process_util_linux.cc') diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc index 6138c07..4627aa5 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) -- cgit v1.1