Index: base/command_line.cc |
diff --git a/base/command_line.cc b/base/command_line.cc |
index b335e7c01a7d3f49ad8547b3d9efb1a3ac17b10d..74205f9d1399bdd5a1644b8d5c2544b6df7e54b3 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(FILE_PATH_LITERAL("/proc/self/exe")); |
Evan Martin
2010/11/30 21:09:30
FILE_PATH_LITERAL unnecessary. (This code will on
Greg Spencer (Chromium)
2010/11/30 22:15:07
Removed.
|
+ 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)"; |