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

Unified Diff: base/process/launch_posix.cc

Issue 308073002: Clear environment variables for nacl_helper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months 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 | « base/process/launch.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/launch_posix.cc
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 457234f5b790a2b118a2e83d41212b9c9b8d6080..490c0ce84890fe9a30a6928ef7d238c2473f51b7 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -292,8 +292,12 @@ bool LaunchProcess(const std::vector<std::string>& argv,
scoped_ptr<char*[]> argv_cstr(new char*[argv.size() + 1]);
scoped_ptr<char*[]> new_environ;
+ char* const empty_environ = NULL;
+ char* const* old_environ = GetEnvironment();
+ if (options.clear_environ)
+ old_environ = &empty_environ;
if (!options.environ.empty())
- new_environ = AlterEnvironment(GetEnvironment(), options.environ);
+ new_environ = AlterEnvironment(old_environ, options.environ);
sigset_t full_sigset;
sigfillset(&full_sigset);
@@ -419,7 +423,7 @@ bool LaunchProcess(const std::vector<std::string>& argv,
}
}
- if (!options.environ.empty())
+ if (!options.environ.empty() || options.clear_environ)
SetEnvironment(new_environ.get());
// fd_shuffle1 is mutated by this call because it cannot malloc.
« no previous file with comments | « base/process/launch.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698