| Index: base/command_line.cc
|
| diff --git a/base/command_line.cc b/base/command_line.cc
|
| index b335e7c01a7d3f49ad8547b3d9efb1a3ac17b10d..427bed4ad2a218545cefb81ee084a30da8d8e000 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)";
|
|
|