sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 567869a8fe138f23a0a2c6cea903747517a81b0a
parent 7ec616e1e5040e7c4b8c1e6dae0fc656e744a90f
Author: sin <sin@2f30.org>
Date:   Sat,  4 Jan 2014 14:01:22 +0000

Check the exit status and return it from the parent process

Diffstat:
Mxargs.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/xargs.c b/xargs.c @@ -229,10 +229,15 @@ runcmd(void) eprintf("fork:"); if (pid == 0) { execvp(*cmd, cmd); - eprintf("execvp %s:", *cmd); + weprintf("execvp %s:", *cmd); _exit(errno == ENOENT ? 127 : 126); } wait(&status); - if (WIFEXITED(status) && WEXITSTATUS(status) == 255) - exit(124); + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) == 255) + exit(124); + if (WEXITSTATUS(status) == 127 || + WEXITSTATUS(status) == 126) + exit(WEXITSTATUS(status)); + } }