From 5317e1c7a911933eb699a349ab499e13f24ae7be Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sun, 27 Aug 2006 23:50:30 +0000 Subject: re PR driver/27622 (gcc hang when compiling with -pipe) PR driver/27622 * pex-common.h (struct pex_funcs): Add toclose parameter to exec_child field. * pex-common.c (pex_run_in_environment): Pass toclose to exec_child. * pex-djgpp.c (pex_djgpp_exec_child): Add toclose parameter. * pex-unix.c (pex_unix_exec_child): Likewise. * pex-msdos.c (pex_msdos_exec_child): Likewise. * pex-win32.c (pex_win32_exec_child): Likewise. From-SVN: r116494 --- libiberty/pex-unix.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libiberty/pex-unix.c') 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) -- cgit v1.2.3