[PATCH] xargs: do not over decrease orig_arg_max

Nguyễn Thái Ngọc Duy pclouds at gmail.com
Tue Apr 6 18:44:41 UTC 2010


When ARG_MAX is not defined, it will be default to 470 (in
xargs.c) and obviously should not be decreased by 2048.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds at gmail.com>
---
 This solution may be terribly wrong though..

 findutils/xargs.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/findutils/xargs.c b/findutils/xargs.c
index f5dbc78..a8ce406 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -409,9 +409,10 @@ int xargs_main(int argc, char **argv)
 	}
 
 	orig_arg_max = ARG_MAX;
-	if (orig_arg_max == -1)
+	if (orig_arg_max == -1) {
 		orig_arg_max = LONG_MAX;
-	orig_arg_max -= 2048;   /* POSIX.2 requires subtracting 2048 */
+		orig_arg_max -= 2048;   /* POSIX.2 requires subtracting 2048 */
+	}
 
 	if (opt & OPT_UPTO_SIZE) {
 		n_max_chars = xatoul_range(max_chars, 1, orig_arg_max);
-- 
1.7.0.rc1.541.g2da82.dirty



More information about the busybox mailing list