1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

command -x: fix 'args list too long' on Linux, again (re: 8f5235a5)

This time it was failing on a 64-bit Debian Linux system with very
few and short environment variables. Sigh.

src/cmd/ksh93/sh/path.c:
- Combine the strategy from 63979488 with that of 8f5235a5.
This commit is contained in:
Martijn Dekker 2021-02-03 20:05:12 +00:00
parent 8f5235a53f
commit 9ddb45b12d

View file

@ -162,7 +162,7 @@ static pid_t path_xargs(Shell_t *shp,const char *path, char *argv[],char *const
pid_t pid;
if(shp->xargmin < 0)
return((pid_t)-1);
size = shp->gd->lim.arg_max - 2048;
size = shp->gd->lim.arg_max - (ARG_EXTRA_BYTES > 2 ? 1024*ARG_EXTRA_BYTES : 2048);
for(ev=envp; cp= *ev; ev++)
size -= 2 * (strlen(cp) + 1 + ARG_EXTRA_BYTES);
for(av=argv; (cp= *av) && av< &argv[shp->xargmin]; av++)