From 5d14e3d50aa995f8d37c82ace354fe41927e785c Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Tue, 13 Jan 2009 07:40:51 +0000 Subject: [PATCH] re PR bootstrap/38580 (Bootstrap broken on mingw32) PR bootstrap/38580 * gcc.c (process_command): Replace call to execvp with calls to pex_one and exit. From-SVN: r143330 --- gcc/ChangeLog | 6 ++++++ gcc/gcc.c | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e3ccd79..6e4aa8e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-01-13 Danny Smith + + PR bootstrap/38580 + * gcc.c (process_command): Replace call to execvp with calls + to pex_one and exit. + 2009-01-03 Anatoly Sokolov PR target/29141 diff --git a/gcc/gcc.c b/gcc/gcc.c index 8e1938b..e85d25d 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -1,6 +1,6 @@ /* Compiler driver program that can handle many languages. Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GCC. @@ -3382,6 +3382,9 @@ process_command (int argc, const char **argv) char **new_argv; char *new_argv0; int baselen; + int status = 0; + int err = 0; + const char *errmsg; while (argc > 1 && argv[1][0] == '-' && (argv[1][1] == 'V' @@ -3424,8 +3427,18 @@ process_command (int argc, const char **argv) new_argv = XDUPVEC (char *, argv, argc + 1); new_argv[0] = new_argv0; - execvp (new_argv0, new_argv); - fatal ("couldn't run '%s': %s", new_argv0, xstrerror (errno)); + errmsg = pex_one (PEX_SEARCH, new_argv0, new_argv, progname, NULL, + NULL, &status, &err); + + if (errmsg) + { + if (err == 0) + fatal ("couldn't run '%s': %s", new_argv0, errmsg); + else + fatal ("couldn't run '%s': %s: %s", new_argv0, errmsg, + xstrerror (err)); + } + exit (status); } /* Set up the default search paths. If there is no GCC_EXEC_PREFIX, -- 2.7.4