]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libiberty/pex-common.c
Patch to provide pex_run_in_environment.
[thirdparty/gcc.git] / libiberty / pex-common.c
index ebe8c437590ed36816832377d17c394b0a3291be..3daa638d402b4521a2d416f4a5ea76a85cc1c9ef 100644 (file)
@@ -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 *