sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit 67ca2428d5554e251651e39ef6d74cdcddcefa28
parent 7ebf02d749a0858981a1c8f38610cb7a0ba0ebb3
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 27 Mar 2015 22:43:55 +0100

xargs: fix sysconf(_SC_ARG_MAX)

the minimum space required by environment variables isn't clearly defined by
POSIX afaik.

Diffstat:
Mxargs.c | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xargs.c b/xargs.c @@ -191,16 +191,15 @@ usage(void) int main(int argc, char *argv[]) { - int leftover = 0; + int leftover = 0, i; size_t argsz, argmaxsz; + size_t arglen, a; char *arg = ""; - int i, a; - argmaxsz = sysconf(_SC_ARG_MAX); - if (argmaxsz < 0) - eprintf("sysconf:"); + if ((argmaxsz = sysconf(_SC_ARG_MAX)) == (size_t)-1) + argmaxsz = _POSIX_ARG_MAX; /* Leave some room for environment variables */ - argmaxsz -= 4 * 1024; + argmaxsz -= 4096; ARGBEGIN { case 'n':