[hackers] [sbase] Exit with error code 123 if one or more invocations of cmd failed || sin
commit 59222b919398fdee5fc7bcf186bd32f1999e85b8
Author: sin <sin_AT_2f30.org>
Date: Mon Jan 6 18:51:06 2014 +0000
Exit with error code 123 if one or more invocations of cmd failed
diff --git a/xargs.c b/xargs.c
index 9a0b74c..1eb9bff 100644
--- a/xargs.c
+++ b/xargs.c
_AT_@ -26,6 +26,7 @@ static char **cmd;
static char *argb;
static size_t argbsz = 1;
static size_t argbpos;
+static int nerrors = 0;
static int rflag = 0;
static void
_AT_@ -93,7 +94,8 @@ main(int argc, char *argv[])
free(argb);
free(cmd);
- return 0;
+
+ return nerrors > 0 ? 123 : 0;
}
static int
_AT_@ -245,6 +247,8 @@ runcmd(void)
if (WEXITSTATUS(status) == 127 ||
WEXITSTATUS(status) == 126)
exit(WEXITSTATUS(status));
+ if (status != 0)
+ nerrors++;
}
if (WIFSIGNALED(status))
exit(125);
Received on Mon Jan 06 2014 - 19:53:34 CET
This archive was generated by hypermail 2.3.0
: Mon Jan 06 2014 - 20:00:09 CET