summaryrefslogtreecommitdiff
path: root/libiberty/pex-unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libiberty/pex-unix.c')
-rw-r--r--libiberty/pex-unix.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libiberty/pex-unix.c b/libiberty/pex-unix.c
index e006e599297..c5fa984817e 100644
--- a/libiberty/pex-unix.c
+++ b/libiberty/pex-unix.c
@@ -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)