~chromium-team/chromium-browser/artful-beta

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--- a/content/common/set_process_title.cc
+++ b/content/common/set_process_title.cc
@@ -67,6 +67,9 @@ void SetProcessTitleFromCommandLine(cons
     // when the full command line is not being displayed in most process
     // listings.
     prctl(PR_SET_NAME, base::FilePath(title).BaseName().value().c_str());
+
+    // Limits the exe path part in the title
+    title = base::FilePath(title).BaseName().value().c_str();
   }
 #endif  // defined(OS_LINUX)
 
--- a/content/common/set_process_title_linux.cc
+++ b/content/common/set_process_title_linux.cc
@@ -44,6 +44,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <stddef.h>
 
 extern char** environ;
 
@@ -87,7 +88,11 @@ void setproctitle(const char* fmt, ...)
   // Put the title in argv[0]. We have to zero out the space first since the
   // kernel doesn't actually look for a null terminator unless we make the
   // argument list longer than it started.
-  avail_size = page_end - (uintptr_t) g_main_argv[0];
+  avail_size = 0;
+  for (i = 0; g_main_argv[i]; ++i) {
+    avail_size += strlen(g_main_argv[i]) + 1;
+  }
+
   memset(g_main_argv[0], 0, avail_size);
   va_start(ap, fmt);
   if (fmt[0] == '-') {