1 diff -up netkit-ftp-0.17/ftp/glob.c.arg_max netkit-ftp-0.17/ftp/glob.c
2 --- netkit-ftp-0.17/ftp/glob.c.arg_max 2008-04-07 11:41:14.000000000 +0200
3 +++ netkit-ftp-0.17/ftp/glob.c 2008-04-07 12:01:53.000000000 +0200
4 @@ -50,6 +50,7 @@ char glob_rcsid[] =
10 #include "ftp_var.h" /* for protos only */
12 @@ -57,7 +58,7 @@ char glob_rcsid[] =
15 #define eq(a,b) (strcmp(a, b)==0)
16 -#define GAVSIZ (ARG_MAX/6)
17 +#define GAVSIZ (sysconf(_SC_ARG_MAX)/6)
18 #define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR)
21 @@ -115,7 +116,7 @@ char **
22 ftpglob(const char *v)
25 - entry agargv[GAVSIZ];
30 @@ -133,6 +134,8 @@ ftpglob(const char *v)
31 /* added ()'s to sizeof, (ambigious math for the compiler) */
32 lastgpathp = agpath + (sizeof(agpath)- 2);
34 + agargv = (entry *)malloc(sizeof (entry) * GAVSIZ);
35 + if (agargv == NULL) fatal("Out of memory");
39 @@ -156,7 +159,7 @@ ginit(entry *agargv)
43 - gnleft = ARG_MAX - 4;
44 + gnleft = sysconf(_SC_ARG_MAX) - 4;
48 @@ -674,6 +677,7 @@ efree(entry *av)
51 for (i=0; av[i].text; i++) free(av[i].text);