]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
windres: quote the angled brackets to avoid confusing shell
authorAlibek Omarov <a1ba.omarov@gmail.com>
Thu, 22 Jan 2026 22:35:18 +0000 (03:35 +0500)
committerAlan Modra <amodra@gmail.com>
Sat, 24 Jan 2026 03:33:46 +0000 (14:03 +1030)
When invoking windres with a preprocessor parameter that contains angled
brackets, the shell will try to interpret them, leading to an error.

For example with an empty test.rc file:

$ i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc
sh: 1: cannot open foo: No such file
i686-w64-mingw32-windres: preprocessing failed.

After patch it correctly complains about no resources baked in:

$ ./i686-w64-mingw32-windres '-DTEST=<foo>' -o test.o -i test.rc
./i686-w64-mingw32-windres: no resources

Signed-off-by: Alibek Omarov <a1ba.omarov@gmail.com>
binutils/windres.c

index e7dd61aad4ffac4077bc621244499c4c440e9769..11cf3d5652c1526dbab78df303158327e8dfe479 100644 (file)
@@ -692,7 +692,7 @@ quot (const char *string)
 
   for (src = string, dest = buf; *src; src++, dest++)
     {
-      if (*src == '(' || *src == ')' || *src == ' ')
+      if (*src == '(' || *src == ')' || *src == ' ' || *src == '<' || *src == '>')
        *dest++ = '\\';
       *dest = *src;
     }