From 21c33bcbe36377abf01614fb1b9be439a3b6de20 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 27 Nov 2020 14:18:20 +0000 Subject: [PATCH 2/2] Allow spaces in the name of the external preprocessor used by windres. PR 26865 * windres.c (main): If the preprocessor name includes spaces, ensure that it is quoted. --- binutils/ChangeLog | 6 ++++++ binutils/windres.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/binutils/windres.c b/binutils/windres.c index 3f691d3e829e..f0f6433160c3 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -885,10 +885,7 @@ main (int argc, char **argv) case OPTION_PREPROCESSOR: if (strchr (optarg, ' ')) - { - if (asprintf (& preprocessor, "\"%s\"", optarg) == -1) - preprocessor = optarg; - } + preprocessor = xasprintf ("\"%s\"", optarg); else preprocessor = optarg; break; diff --git a/binutils/windres.c b/binutils/windres.c index 5c83dab8fc0..df3e01fd941 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -885,7 +885,13 @@ main (int argc, char **argv) break; case OPTION_PREPROCESSOR: - preprocessor = optarg; + if (strchr (optarg, ' ')) + { + if (asprintf (& preprocessor, "\"%s\"", optarg) == -1) + preprocessor = optarg; + } + else + preprocessor = optarg; break; case OPTION_PREPROCESSOR_ARG: -- 2.30.2