commit 5f0c664cc1a2753225a757d88c7f137b03a3e812
parent a0998d0252cff0bce7c2e41505b2505f536ae964
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Fri, 19 Sep 2025 12:04:47 +0200
xargs: fix a regression with incorrectly using escaping with the -0 flag
The modified version of the original patch caused a regression and handling
escaping with the -0 where it shouldn't.
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/xargs.c b/xargs.c
@@ -108,6 +108,14 @@ poparg(void)
if (eatspace() < 0)
return NULL;
while ((ch = inputc()) != EOF) {
+ /* NUL separator: no escaping */
+ if (nulflag) {
+ if (ch == '\0')
+ goto out;
+ else
+ goto fill;
+ }
+
switch (ch) {
case ' ':
case '\t':
@@ -127,10 +135,6 @@ poparg(void)
if (parseescape() < 0)
eprintf("backslash at EOF\n");
break;
- case '\0':
- /* NUL separator: no escaping */
- if (nulflag)
- goto out;
default:
fill:
fillargbuf(ch);