diff options
author | Denys Vlasenko | 2018-10-30 14:40:17 +0100 |
---|---|---|
committer | Denys Vlasenko | 2018-10-30 14:40:17 +0100 |
commit | f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8 (patch) | |
tree | 054bf423fa4cb8b2ddc6dc330efe8780f63e2ce2 | |
parent | c8e3922ad838751e45bf4b3cb8608b228ee83c71 (diff) | |
download | busybox-f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8.zip busybox-f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8.tar.gz |
xargs: fix exit code if command exits nonzero, closes 11381
No code size change on x86.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | findutils/xargs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c index c369bda..0dedb63 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c @@ -204,14 +204,15 @@ static int xargs_exec(void) status = (errno == ENOENT) ? 127 : 126; } else if (status >= 0x180) { - bb_error_msg("'%s' terminated by signal %d", + bb_error_msg("'%s' terminated by signal %u", G.args[0], status - 0x180); status = 125; } else if (status != 0) { if (status == 255) { bb_error_msg("%s: exited with status 255; aborting", G.args[0]); - return 124; + status = 124; + goto ret; } /* "123 if any invocation of the command exited with status 1-125" * This implies that nonzero exit code is remembered, @@ -220,7 +221,7 @@ static int xargs_exec(void) G.xargs_exitcode = 123; status = 0; } - + ret: if (status != 0) G.xargs_exitcode = status; return status; |