xargs: fix sysconf(_SC_ARG_MAX)
the minimum space required by environment variables isn't clearly defined by POSIX afaik.
This commit is contained in:
parent
7ebf02d749
commit
67ca2428d5
11
xargs.c
11
xargs.c
@ -191,16 +191,15 @@ usage(void)
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int leftover = 0;
|
int leftover = 0, i;
|
||||||
size_t argsz, argmaxsz;
|
size_t argsz, argmaxsz;
|
||||||
|
size_t arglen, a;
|
||||||
char *arg = "";
|
char *arg = "";
|
||||||
int i, a;
|
|
||||||
|
|
||||||
argmaxsz = sysconf(_SC_ARG_MAX);
|
if ((argmaxsz = sysconf(_SC_ARG_MAX)) == (size_t)-1)
|
||||||
if (argmaxsz < 0)
|
argmaxsz = _POSIX_ARG_MAX;
|
||||||
eprintf("sysconf:");
|
|
||||||
/* Leave some room for environment variables */
|
/* Leave some room for environment variables */
|
||||||
argmaxsz -= 4 * 1024;
|
argmaxsz -= 4096;
|
||||||
|
|
||||||
ARGBEGIN {
|
ARGBEGIN {
|
||||||
case 'n':
|
case 'n':
|
||||||
|
Loading…
Reference in New Issue
Block a user