From: Alexandre Oliva Date: Thu, 16 Jan 2020 06:58:50 +0000 (-0300) Subject: [libiberty] output empty args as a pair of quotes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=18193e8f005320db5ce47067f076680bef7d7532;p=gcc.git [libiberty] output empty args as a pair of quotes writeargv writes out empty arguments in a way that expandargv skips them instead of preserving them. Fixed by writing out a pair of quotes for them. for libiberty/ChangeLog * argv.c (writeargv): Output empty args as "". --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index c2bab93a151..17903ea1be5 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2020-01-23 Alexandre Oliva + + * argv.c (writeargv): Output empty args as "". + 2020-01-01 Jakub Jelinek Update copyright years. diff --git a/libiberty/argv.c b/libiberty/argv.c index 8c9794db6a2..6a72208d845 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -327,6 +327,14 @@ writeargv (char * const *argv, FILE *f) arg++; } + /* Write out a pair of quotes for an empty argument. */ + if (arg == *argv) + if (EOF == fputs ("\"\"", f)) + { + status = 1; + goto done; + } + if (EOF == fputc ('\n', f)) { status = 1;