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
This commit is contained in:
parent
fc004c627e
commit
64aff96613
@ -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 @@ arg1: if (insingle || indouble)
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user