diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-10-30 14:40:17 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-10-30 14:40:17 +0100 |
commit | f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8 (patch) | |
tree | 054bf423fa4cb8b2ddc6dc330efe8780f63e2ce2 | |
parent | c8e3922ad838751e45bf4b3cb8608b228ee83c71 (diff) | |
download | busybox-w32-f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8.tar.gz busybox-w32-f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8.tar.bz2 busybox-w32-f3e2838fc4e6bd0713d7ee5a17e752a19870a0f8.zip |
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 c369bdaf5..0dedb6356 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -204,14 +204,15 @@ static int xargs_exec(void) | |||
204 | status = (errno == ENOENT) ? 127 : 126; | 204 | status = (errno == ENOENT) ? 127 : 126; |
205 | } | 205 | } |
206 | else if (status >= 0x180) { | 206 | else if (status >= 0x180) { |
207 | bb_error_msg("'%s' terminated by signal %d", | 207 | bb_error_msg("'%s' terminated by signal %u", |
208 | G.args[0], status - 0x180); | 208 | G.args[0], status - 0x180); |
209 | status = 125; | 209 | status = 125; |
210 | } | 210 | } |
211 | else if (status != 0) { | 211 | else if (status != 0) { |
212 | if (status == 255) { | 212 | if (status == 255) { |
213 | bb_error_msg("%s: exited with status 255; aborting", G.args[0]); | 213 | bb_error_msg("%s: exited with status 255; aborting", G.args[0]); |
214 | return 124; | 214 | status = 124; |
215 | goto ret; | ||
215 | } | 216 | } |
216 | /* "123 if any invocation of the command exited with status 1-125" | 217 | /* "123 if any invocation of the command exited with status 1-125" |
217 | * This implies that nonzero exit code is remembered, | 218 | * This implies that nonzero exit code is remembered, |
@@ -220,7 +221,7 @@ static int xargs_exec(void) | |||
220 | G.xargs_exitcode = 123; | 221 | G.xargs_exitcode = 123; |
221 | status = 0; | 222 | status = 0; |
222 | } | 223 | } |
223 | 224 | ret: | |
224 | if (status != 0) | 225 | if (status != 0) |
225 | G.xargs_exitcode = status; | 226 | G.xargs_exitcode = status; |
226 | return status; | 227 | return status; |