svn commit: r232108 - head/usr.bin/xargs
Jilles Tjoelker
jilles at FreeBSD.org
Fri Feb 24 12:35:18 UTC 2012
Author: jilles
Date: Fri Feb 24 12:35:17 2012
New Revision: 232108
URL: http://svn.freebsd.org/changeset/base/232108
Log:
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
Modified:
head/usr.bin/xargs/xargs.c
Modified: head/usr.bin/xargs/xargs.c
==============================================================================
--- head/usr.bin/xargs/xargs.c Fri Feb 24 12:32:50 2012 (r232107)
+++ head/usr.bin/xargs/xargs.c Fri Feb 24 12:35:17 2012 (r232108)
@@ -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 waita
* 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;
}
More information about the svn-src-head
mailing list