Blame SOURCES/netkit-ftp-0.17-arg_max1.patch

341b9b
diff -up netkit-ftp-0.17/ftp/glob.c.arg_max1 netkit-ftp-0.17/ftp/glob.c
341b9b
--- netkit-ftp-0.17/ftp/glob.c.arg_max1	2012-01-24 12:59:09.335021131 +0100
341b9b
+++ netkit-ftp-0.17/ftp/glob.c	2012-01-24 13:05:27.752028732 +0100
341b9b
@@ -55,10 +55,15 @@ char glob_rcsid[] = 
341b9b
 #include "ftp_var.h"  /* for protos only */
341b9b
 #include "glob.h"
341b9b
 
341b9b
+#ifndef LOWEST_ARG_MAX
341b9b
+  #define LOWEST_ARG_MAX       2621440	/* ARG_MAX for default stack size limit 10240 */
341b9b
+#endif
341b9b
+
341b9b
 #define	QUOTE 0200
341b9b
 #define	TRIM 0177
341b9b
 #define	eq(a,b)		(strcmp(a, b)==0)
341b9b
-#define	GAVSIZ		(sysconf(_SC_ARG_MAX)/6)
341b9b
+#define	max(a,b)	(a > b ? a : b)
341b9b
+#define	GAVSIZ		(max((int)sysconf(_SC_ARG_MAX), LOWEST_ARG_MAX)/6)
341b9b
 #define	isdir(d)	((d.st_mode & S_IFMT) == S_IFDIR)
341b9b
 
341b9b
 const char *globerr;
341b9b
@@ -159,7 +164,7 @@ ginit(entry *agargv)
341b9b
 	gargv = agargv; 
341b9b
 	sortbas = agargv; 
341b9b
 	gargc = 0;
341b9b
-	gnleft = sysconf(_SC_ARG_MAX) - 4;
341b9b
+	gnleft = max((int)sysconf(_SC_ARG_MAX), LOWEST_ARG_MAX) - 4;
341b9b
 }
341b9b
 
341b9b
 static