diff options
Diffstat (limited to 'libiberty/pex-common.c')
-rw-r--r-- | libiberty/pex-common.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/libiberty/pex-common.c b/libiberty/pex-common.c index ebe8c437590..3daa638d402 100644 --- a/libiberty/pex-common.c +++ b/libiberty/pex-common.c @@ -142,12 +142,15 @@ temp_file (struct pex_obj *obj, int flags, char *name) return name; } -/* Run a program. */ + +/* As for pex_run (), but permits the environment for the child process + to be specified. */ const char * -pex_run (struct pex_obj *obj, int flags, const char *executable, - char * const * argv, const char *orig_outname, const char *errname, - int *err) +pex_run_in_environment (struct pex_obj *obj, int flags, const char *executable, + char * const * argv, char * const * env, + const char *orig_outname, const char *errname, + int *err) { const char *errmsg; int in, out, errdes; @@ -296,8 +299,8 @@ pex_run (struct pex_obj *obj, int flags, const char *executable, /* Run the program. */ - pid = obj->funcs->exec_child (obj, flags, executable, argv, in, out, errdes, - &errmsg, err); + pid = obj->funcs->exec_child (obj, flags, executable, argv, env, + in, out, errdes, &errmsg, err); if (pid < 0) goto error_exit; @@ -319,6 +322,17 @@ pex_run (struct pex_obj *obj, int flags, const char *executable, return errmsg; } +/* Run a program. */ + +const char * +pex_run (struct pex_obj *obj, int flags, const char *executable, + char * const * argv, const char *orig_outname, const char *errname, + int *err) +{ + return pex_run_in_environment (obj, flags, executable, argv, NULL, + orig_outname, errname, err); +} + /* Return a FILE pointer for a temporary file to fill with input for the pipeline. */ FILE * |