[hackers] [sbase] Check the exit status and return it from the parent process || sin

From: <git_AT_suckless.org>
Date: Sat, 04 Jan 2014 15:02:45 +0100

commit 567869a8fe138f23a0a2c6cea903747517a81b0a
Author: sin <sin_AT_2f30.org>
Date: Sat Jan 4 14:01:22 2014 +0000

    Check the exit status and return it from the parent process

diff --git a/xargs.c b/xargs.c
index b283b5e..612f926 100644
--- a/xargs.c
+++ b/xargs.c
_AT_@ -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));
+ }
 }
Received on Sat Jan 04 2014 - 15:02:45 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 04 2014 - 15:12:08 CET