diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2023-12-23 15:58:59 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2023-12-23 15:58:59 +0000 |
commit | 991dc322061ff248e707525c93fbfb328ec1009d (patch) | |
tree | 0add93676c8b2d80773df1be66b629a61e4b10f4 /usr.bin/xargs | |
parent | e5401b79a15d29ecece6cb082bad1808b773e2fd (diff) |
Suppress a spurious empty arg at EOF w/ "find -0" caused by the last commit.
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r-- | usr.bin/xargs/xargs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 70f9d9d9816..38d14850efd 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xargs.c,v 1.37 2023/12/22 17:12:13 millert Exp $ */ +/* $OpenBSD: xargs.c,v 1.38 2023/12/23 15:58:58 millert Exp $ */ /* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */ /*- @@ -296,8 +296,12 @@ arg2: foundeof = *eofstr != '\0' && strcmp(argp, eofstr) == 0; - /* Do not make empty args unless they are quoted */ - if ((zflag || argp != p || wasquoted) && !foundeof) { + /* + * Do not make empty args unless they are quoted or + * we are run as "find -0" and not at EOF. + */ + if (((zflag && ch != EOF) || argp != p || wasquoted) && + !foundeof) { *p++ = '\0'; *xp++ = argp; if (Iflag) { |