diff options
author | jilles <jilles@FreeBSD.org> | 2012-02-24 12:35:17 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2012-02-24 12:35:17 +0000 |
commit | 64aff966136992a8069899b16557c1c2c14f3762 (patch) | |
tree | ecac441a221214d268993d6b61b1e7e6f9157c0e /usr.bin/xargs | |
parent | fc004c627e517f3c1c39fe9cb02977e71f5cb0f9 (diff) | |
download | FreeBSD-src-64aff966136992a8069899b16557c1c2c14f3762.zip FreeBSD-src-64aff966136992a8069899b16557c1c2c14f3762.tar.gz |
xargs: If a utility exits with 255 or a signal, write an error message.
If a utility called by xargs exits with status 255 or because of a signal,
POSIX requires writing an error message.
PR: 165155
Submitted by: Matthew Story matthewstory gmail com
Diffstat (limited to 'usr.bin/xargs')
-rw-r--r-- | usr.bin/xargs/xargs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/xargs/xargs.c b/usr.bin/xargs/xargs.c index 0954800..35d07c7 100644 --- a/usr.bin/xargs/xargs.c +++ b/usr.bin/xargs/xargs.c @@ -281,7 +281,7 @@ parse_input(int argc, char *argv[]) case EOF: /* No arguments since last exec. */ if (p == bbp) { - waitchildren(*argv, 1); + waitchildren(*av, 1); exit(rval); } goto arg1; @@ -368,7 +368,7 @@ arg2: } prerun(argc, av); if (ch == EOF || foundeof) { - waitchildren(*argv, 1); + waitchildren(*av, 1); exit(rval); } p = bbp; @@ -608,8 +608,11 @@ waitchildren(const char *name, int waitall) * If utility signaled or exited with a value of 255, * exit 1-125. */ - if (WIFSIGNALED(status) || WEXITSTATUS(status) == 255) - exit(1); + if (WIFSIGNALED(status)) + errx(1, "%s: terminated with signal %d, aborting", + name, WTERMSIG(status)); + if (WEXITSTATUS(status) == 255) + errx(1, "%s: exited with status 255, aborting", name); if (WEXITSTATUS(status)) rval = 1; } |