This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lto][patch] Use @args when calling xgcc from lto-wrapper
- From: Rafael Espindola <espindola at google dot com>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Diego Novillo <dnovillo at google dot com>
- Date: Mon, 2 Feb 2009 18:57:44 +0000
- Subject: Re: [lto][patch] Use @args when calling xgcc from lto-wrapper
- References: <38a0d8450901290812q19fc8926s9cf715e98b42cb32@mail.gmail.com> <de8d50360901291144q5d6cf90dw7a7f394ee4e3af37@mail.gmail.com>
> You should also use writeargv here instead of writing out the
> arguments manually.
The attached patch does that.
2009-02-02 Rafael Avila de Espindola <espindola@google.com>
* lto-wrapper.c (fork_execute): Use writeargv.
> Thanks,
> Andrew Pinski
>
Cheers,
--
Rafael Avila de Espindola
Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index aafaa7f..06c8690 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -181,12 +181,15 @@ fork_execute (char **argv)
char *args_name = make_temp_file(".args");
char *at_args = concat ("@", args_name, NULL);
FILE *args = fopen (args_name, "w");
- int i;
+ int status;
if (args == NULL)
fatal ("failed to open %s", args_name);
- for (i = 1; argv[i]; i++)
- fprintf (args, "%s\n", argv[i]);
+
+ status = writeargv (&argv[1], args);
+
+ if (status)
+ fatal ("could not write to temporary file %s", args_name);
fclose (args);