merge from gcc
[deliverable/binutils-gdb.git] / libiberty / pex-unix.c
index e006e5992978b67591ff990c07ba57e15dad0f63..c5fa984817e7582a5fd6dc6dc5326ffe9eaf6495 100644 (file)
@@ -271,7 +271,8 @@ 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 *, char * const *,
-                                 int, int, int, const char **, int *);
+                                int, 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 *);
@@ -358,7 +359,7 @@ static long
 pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
                     char * const * argv, char * const * env,
                      int in, int out, int errdes,
-                    const char **errmsg, int *err)
+                    int toclose, const char **errmsg, int *err)
 {
   pid_t pid;
 
@@ -408,6 +409,11 @@ pex_unix_exec_child (struct pex_obj *obj, int flags, const char *executable,
          if (close (errdes) < 0)
            pex_child_error (obj, executable, "close", errno);
        }
+      if (toclose >= 0)
+       {
+         if (close (toclose) < 0)
+           pex_child_error (obj, executable, "close", errno);
+       }
       if ((flags & PEX_STDERR_TO_STDOUT) != 0)
        {
          if (dup2 (STDOUT_FILE_NO, STDERR_FILE_NO) < 0)
This page took 0.024506 seconds and 4 git commands to generate.