aboutsummaryrefslogtreecommitdiff
path: root/libiberty/pex-unix.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2006-08-28 00:56:25 +0000
committerDJ Delorie <dj@redhat.com>2006-08-28 00:56:25 +0000
commitcb6c09ace53de4a2952de95ff0f1f91e4809fbaa (patch)
treef1bcc51e7ead9bc22f4332bf59ddac7302656d6b /libiberty/pex-unix.c
parent289397ccec5e89b311f173c9ea5df19cfb323587 (diff)
downloadgdb-cb6c09ace53de4a2952de95ff0f1f91e4809fbaa.zip
gdb-cb6c09ace53de4a2952de95ff0f1f91e4809fbaa.tar.gz
gdb-cb6c09ace53de4a2952de95ff0f1f91e4809fbaa.tar.bz2
merge from gcc
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 e006e59..c5fa984 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)