diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 21:26:47 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 21:26:47 +0000 |
commit | 3d2217d4327f2033ace44ab0aa87c9f50fc011fe (patch) | |
tree | 89444d2d3ceb9134ab9c0a8e35d06afe388c0966 | |
parent | ab417244b7fe6b281eaba42c10a045efd8474bb1 (diff) | |
download | chromium_src-3d2217d4327f2033ace44ab0aa87c9f50fc011fe.zip chromium_src-3d2217d4327f2033ace44ab0aa87c9f50fc011fe.tar.gz chromium_src-3d2217d4327f2033ace44ab0aa87c9f50fc011fe.tar.bz2 |
Fix environment variables not being used after switching to ChildProcessLauncher.
BUG=28602
TEST=verified flash works on Mac
Review URL: http://codereview.chromium.org/439005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32854 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/process_util.h | 2 | ||||
-rw-r--r-- | base/process_util_posix.cc | 13 | ||||
-rw-r--r-- | chrome/browser/child_process_launcher.cc | 4 | ||||
-rw-r--r-- | chrome/browser/importer/firefox_importer_unittest_utils_mac.cc | 7 | ||||
-rw-r--r-- | chrome/browser/plugin_process_host.cc | 4 |
5 files changed, 16 insertions, 14 deletions
diff --git a/base/process_util.h b/base/process_util.h index cd26c2a..41d1d17 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -150,7 +150,7 @@ bool LaunchApp(const std::vector<std::string>& argv, // Similar to above, but also (un)set environment variables in child process // through |environ|. -typedef std::vector<std::pair<const char*, const char*> > environment_vector; +typedef std::vector<std::pair<std::string, std::string> > environment_vector; bool LaunchApp(const std::vector<std::string>& argv, const environment_vector& environ, const file_handle_mapping_vector& fds_to_remap, diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc index 8b6987d..4392c7b 100644 --- a/base/process_util_posix.cc +++ b/base/process_util_posix.cc @@ -302,12 +302,13 @@ bool LaunchApp(const std::vector<std::string>& argv, for (environment_vector::const_iterator it = environ.begin(); it != environ.end(); ++it) { - if (it->first) { - if (it->second) { - setenv(it->first, it->second, 1); - } else { - unsetenv(it->first); - } + if (it->first.empty()) + continue; + + if (it->second.empty()) { + unsetenv(it->first.c_str()); + } else { + setenv(it->first.c_str(), it->second.c_str(), 1); } } diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc index 73cc9dc..9b8cae9 100644 --- a/chrome/browser/child_process_launcher.cc +++ b/chrome/browser/child_process_launcher.cc @@ -62,6 +62,7 @@ class ChildProcessLauncher::Context #if defined(OS_WIN) exposed_dir, #elif defined(POSIX) + environ, ipcfd, #endif cmd_line)); @@ -86,6 +87,7 @@ class ChildProcessLauncher::Context #if defined(OS_WIN) const FilePath& exposed_dir, #elif defined(OS_POSIX) + const base::environment_vector& env, int ipcfd, #endif CommandLine* cmd_line) { @@ -157,7 +159,7 @@ class ChildProcessLauncher::Context #endif // defined(OS_LINUX) // Actually launch the app. - if (!base::LaunchApp(cmd_line->argv(), fds_to_map, false, &handle)) + if (!base::LaunchApp(cmd_line->argv(), env, fds_to_map, false, &handle)) handle = base::kNullProcessHandle; } #endif diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc index 7b559bb..03dddc7 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc @@ -41,9 +41,9 @@ bool LaunchNSSDecrypterChildProcess(const std::wstring& nss_path, // See "chrome/browser/importer/nss_decryptor_mac.mm" for an explanation of // why we need this. base::environment_vector env; - std::pair<const char*,const char*> dyld_override; + std::pair<std::string, std::string> dyld_override; dyld_override.first = "DYLD_FALLBACK_LIBRARY_PATH"; - dyld_override.second = ff_dylib_dir.value().c_str(); + dyld_override.second = ff_dylib_dir.value(); env.push_back(dyld_override); base::file_handle_mapping_vector fds_to_map; @@ -56,8 +56,7 @@ bool LaunchNSSDecrypterChildProcess(const std::wstring& nss_path, bool debug_on_start = CommandLine::ForCurrentProcess()->HasSwitch( switches::kDebugChildren); - return base::LaunchApp(cl.argv(), env, fds_to_map, debug_on_start, - handle); + return base::LaunchApp(cl.argv(), env, fds_to_map, debug_on_start, handle); } } // namespace diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc index 422c095..3739c3f 100644 --- a/chrome/browser/plugin_process_host.cc +++ b/chrome/browser/plugin_process_host.cc @@ -420,9 +420,9 @@ bool PluginProcessHost::Init(const WebPluginInfo& info, interpose_list.insert(0, ":"); interpose_list.insert(0, existing_list); } - env.push_back(std::pair<const char*, const char*>( + env.push_back(std::pair<std::string, std::string>( plugin_interpose_strings::kDYLDInsertLibrariesKey, - interpose_list.c_str())); + interpose_list)); #endif #endif |