diff options
author | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 17:37:54 +0000 |
---|---|---|
committer | gspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-03 17:37:54 +0000 |
commit | 723571af3c1a86aa14a68bce2511f3dad399287f (patch) | |
tree | c77043d78d5eb7eb1437071561fce7c8ad9b4a5d /base/command_line.cc | |
parent | 0868ee7ae6d7fbb63ab85dfeafa34d724f9a1b45 (diff) | |
download | chromium_src-723571af3c1a86aa14a68bce2511f3dad399287f.zip chromium_src-723571af3c1a86aa14a68bce2511f3dad399287f.tar.gz chromium_src-723571af3c1a86aa14a68bce2511f3dad399287f.tar.bz2 |
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
Diffstat (limited to 'base/command_line.cc')
-rw-r--r-- | base/command_line.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index b335e7c..427bed4 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -19,6 +19,7 @@ #include <algorithm> #include "base/file_path.h" +#include "base/file_util.h" #include "base/logging.h" #include "base/singleton.h" #include "base/string_split.h" @@ -237,13 +238,11 @@ void CommandLine::SetProcTitle() { // show up as "exe" in process listings. Read the symlink /proc/self/exe and // use the path it points at for our process title. Note that this is only for // display purposes and has no TOCTTOU security implications. - char buffer[PATH_MAX]; - // Note: readlink() does not append a null byte to terminate the string. - ssize_t length = readlink("/proc/self/exe", buffer, sizeof(buffer)); - DCHECK(length <= static_cast<ssize_t>(sizeof(buffer))); - if (length > 0) { + FilePath target; + FilePath self_exe("/proc/self/exe"); + if (file_util::ReadSymbolicLink(self_exe, &target)) { have_argv0 = true; - title.assign(buffer, length); + title = target.value(); // If the binary has since been deleted, Linux appends " (deleted)" to the // symlink target. Remove it, since this is not really part of our name. const std::string kDeletedSuffix = " (deleted)"; |