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 /base | |
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
Diffstat (limited to 'base')
-rw-r--r-- | base/process_util.h | 2 | ||||
-rw-r--r-- | base/process_util_posix.cc | 13 |
2 files changed, 8 insertions, 7 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); } } |