Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1903)

Unified Diff: chrome/common/child_process_host.cc

Issue 403018: linux: use /proc/self/exe when exec'ing ourselves (Closed)
Patch Set: fixed test Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_constants.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/child_process_host.cc
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index d4a9edae18f65a1618109023352df2ef1a1bf3b8..2e0f1f600c45da326389b7640fc34d7c8776069f 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -93,16 +93,20 @@ FilePath ChildProcessHost::GetChildPath() {
if (!child_path.empty())
return child_path;
-#if !defined(OS_MACOSX)
- // On most platforms, the child executable is the same as the current
- // executable.
- PathService::Get(base::FILE_EXE, &child_path);
-#else
+#if defined(OS_LINUX)
+ // Use /proc/self/exe rather than our known binary path so updates
+ // can't swap out the binary from underneath us.
+ child_path = FilePath("/proc/self/exe");
+#elif defined(OS_MACOSX)
// On the Mac, the child executable lives at a predefined location within
// the app bundle's versioned directory.
child_path = chrome::GetVersionedDirectory().
Append(chrome::kHelperProcessExecutablePath);
-#endif // OS_MACOSX
+#else
+ // On most platforms, the child executable is the same as the current
+ // executable.
+ PathService::Get(base::FILE_EXE, &child_path);
+#endif
return child_path;
}
« no previous file with comments | « no previous file | chrome/common/chrome_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698