Blame SOURCES/netkit-ftp-0.17-out-of-memory.patch

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