diff options
author | shinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-01 10:30:51 +0000 |
---|---|---|
committer | shinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-01 10:30:51 +0000 |
commit | 223a68cbc78401d514b5bd0f39d0d1d5e758a38d (patch) | |
tree | 65214f176ae027d313b5e5f7a60900e75c43d3ef /libiberty/pex-unix.c | |
parent | 2114cdb6787393a55e2ec0b9951b90bba0752117 (diff) | |
download | gcc-223a68cbc78401d514b5bd0f39d0d1d5e758a38d.tar.gz |
Patch to provide pex_run_in_environment.
* include/libiberty.h: Declare pex_run_in_environment.
libiberty:
* pex-common.c: New function pex_run_in_environment.
* pex-common.h: Add environment parameter to exec_child.
* pex-msdos.c: Add environment parameter to pex_msdos_exec_child.
* pex-djgpp.c: Add environment parameter to pex_djgpp_exec_child.
(pex_djgpp_exec_child): Pass environment to child process.
* pex-unix.c: Add environment parameter to pex_unix_exec_child.
(pex_unix_exec_child): Pass environment to child process.
* pex-win32.c: Add environment parameter to pex_win32_exec_child.
New function env_compare for comparing VAR=VALUE pairs.
(win32_spawn): Assemble environment block and pass to CreateProcess.
(spawn_script): Pass environment through to win32_spawn.
(pex_win32_exec_child): Pass environment through to spawn_script and
win32_spawn.
* functions.texi: Regenerate.
* pexecute.txh: Document pex_run_in_environment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114302 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/pex-unix.c')
-rw-r--r-- | libiberty/pex-unix.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c index c92a4297971..91619af1e2c 100644 --- a/libiberty/pex-unix.c +++ b/libiberty/pex-unix.c @@ -270,8 +270,8 @@ static void pex_child_error (struct pex_obj *, const char *, const char *, int) static int pex_unix_open_read (struct pex_obj *, const char *, int); static int pex_unix_open_write (struct pex_obj *, const char *, int); static long pex_unix_exec_child (struct pex_obj *, int, const char *, - char * const *, int, int, int, - const char **, int *); + char * const *, char * const *, + int, int, int, const char **, int *); static int pex_unix_close (struct pex_obj *, int); static int pex_unix_wait (struct pex_obj *, long, int *, struct pex_time *, int, const char **, int *); @@ -352,12 +352,16 @@ pex_child_error (struct pex_obj *obj, const char *executable, /* Execute a child. */ +extern char **environ; + static long pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable, - char * const * argv, int in, int out, int errdes, + char * const * argv, char * const * env, + int in, int out, int errdes, const char **errmsg, int *err) { pid_t pid; + /* We declare these to be volatile to avoid warnings from gcc about them being clobbered by vfork. */ volatile int sleep_interval; @@ -409,6 +413,10 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable, if (dup2 (STDOUT_FILE_NO, STDERR_FILE_NO) < 0) pex_child_error (obj, executable, "dup2", errno); } + + if (env) + environ = env; + if ((flags & PEX_SEARCH) != 0) { execvp (executable, argv); |