← Commit list

f3e2838fc

Denys Vlasenko
Denys Vlasenko
2018-10-30
SUCCESS Duration: 146s

Subject

xargs: fix exit code if command exits nonzero, closes 11381

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

findutils/xargs.c+4 -3
@@ -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;