summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 22:17:09 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-23 22:17:09 +0000
commit1c882fe78286e90e483f49ba11480ff075cf61b1 (patch)
treea1b5068e733ac9115e0b9b06c384b22eb69a4d1f
parent8f756096099f4722a72dfdfe8b33bd8a511b63c0 (diff)
downloadchromium_src-1c882fe78286e90e483f49ba11480ff075cf61b1.zip
chromium_src-1c882fe78286e90e483f49ba11480ff075cf61b1.tar.gz
chromium_src-1c882fe78286e90e483f49ba11480ff075cf61b1.tar.bz2
Merge 32854 - 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 TBR=jam@chromium.org Review URL: http://codereview.chromium.org/436011 git-svn-id: svn://svn.chromium.org/chrome/branches/249/src@32867 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/process_util.h2
-rw-r--r--base/process_util_posix.cc13
-rw-r--r--chrome/browser/child_process_launcher.cc4
-rw-r--r--chrome/browser/importer/firefox_importer_unittest_utils_mac.cc7
-rw-r--r--chrome/browser/plugin_process_host.cc4
5 files changed, 16 insertions, 14 deletions
diff --git a/base/process_util.h b/base/process_util.h
index c83dfe1..07b10e7 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 1148f6e..4d786e3 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -305,12 +305,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