summaryrefslogtreecommitdiffstats
path: root/base/process_util_linux.cc
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 07:00:13 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-21 07:00:13 +0000
commit9ec8db0fa5c9e8e449c2552154424535ae20f789 (patch)
treeb3f9dd2bc3f46c10d0657653f97b1cd307b70723 /base/process_util_linux.cc
parent685092ab45505a2bb8c138ecd2207dde16305450 (diff)
downloadchromium_src-9ec8db0fa5c9e8e449c2552154424535ae20f789.zip
chromium_src-9ec8db0fa5c9e8e449c2552154424535ae20f789.tar.gz
chromium_src-9ec8db0fa5c9e8e449c2552154424535ae20f789.tar.bz2
Set GTK_PATH to CHROMIUM_SAVED_GTK_PATH before launching xdg-open.
Wrappers that launch Chromium will need to set CHROMIUM_SAVED_GTK_PATH before modifying GTK_PATH. This can be done later in separate CLs. BUG=15565 TEST=see bug Review URL: http://codereview.chromium.org/159112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/process_util_linux.cc')
-rw-r--r--base/process_util_linux.cc24
1 files changed, 23 insertions, 1 deletions
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index d72e001..4915b8f 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -7,11 +7,12 @@
#include <ctype.h>
#include <dirent.h>
#include <fcntl.h>
-#include <string>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <string>
+
#include "base/eintr_wrapper.h"
#include "base/file_util.h"
#include "base/logging.h"
@@ -86,6 +87,7 @@ FilePath GetProcessExecutablePath(ProcessHandle process) {
}
bool LaunchApp(const std::vector<std::string>& argv,
+ const environment_vector& environ,
const file_handle_mapping_vector& fds_to_remap,
bool wait, ProcessHandle* process_handle) {
pid_t pid = fork();
@@ -93,12 +95,24 @@ bool LaunchApp(const std::vector<std::string>& argv,
return false;
if (pid == 0) {
+ // Child process
InjectiveMultimap fd_shuffle;
for (file_handle_mapping_vector::const_iterator
it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
fd_shuffle.push_back(InjectionArc(it->first, it->second, false));
}
+ 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 (!ShuffleFileDescriptors(fd_shuffle))
exit(127);
@@ -118,6 +132,7 @@ bool LaunchApp(const std::vector<std::string>& argv,
<< ", errno " << errno;
exit(127);
} else {
+ // Parent process
if (wait)
HANDLE_EINTR(waitpid(pid, 0, 0));
@@ -128,6 +143,13 @@ bool LaunchApp(const std::vector<std::string>& argv,
return true;
}
+bool LaunchApp(const std::vector<std::string>& argv,
+ const file_handle_mapping_vector& fds_to_remap,
+ bool wait, ProcessHandle* process_handle) {
+ base::environment_vector no_env;
+ return LaunchApp(argv, no_env, fds_to_remap, wait, process_handle);
+}
+
bool LaunchApp(const CommandLine& cl,
bool wait, bool start_hidden,
ProcessHandle* process_handle) {