Index: xargs.c =================================================================== RCS file: /cvsroot/findutils/findutils/xargs/xargs.c,v retrieving revision 1.17 diff -u -r1.17 xargs.c --- xargs.c 3 Jan 2004 22:55:09 -0000 1.17 +++ xargs.c 1 Jul 2004 11:08:24 -0000 @@ -303,6 +303,7 @@ int optc; int always_run_command = 1; long orig_arg_max; + long size_of_environment = env_size(environ); char *default_cmd = "/bin/echo"; int (*read_args) PARAMS ((void)) = read_line; @@ -324,11 +325,11 @@ have it at 1 meg). Things will work fine with a large ARG_MAX but it will probably hurt the system more than it needs to; an array of this size is allocated. */ - if (arg_max > 20 * 1024) - arg_max = 20 * 1024; + if (arg_max > 20 * 1024 + size_of_environment) + arg_max = 20 * 1024 + size_of_environment; /* Take the size of the environment into account. */ - arg_max -= env_size (environ); + arg_max -= size_of_environment; if (arg_max <= 0) error (1, 0, _("environment is too large for exec")); @@ -383,7 +384,7 @@ break; case 's': - arg_max = parse_num (optarg, 's', 1L, orig_arg_max); + arg_max = parse_num (optarg, 's', 1L, orig_arg_max - size_of_environment); break; case 't':