Index: xargs.c
===================================================================
RCS file: /sources/findutils/findutils/xargs/xargs.c,v
retrieving revision 1.67
diff -u -p -r1.67 xargs.c
--- xargs.c	22 Apr 2007 16:14:49 -0000	1.67
+++ xargs.c	28 Apr 2007 11:32:30 -0000
@@ -442,9 +442,27 @@ main (int argc, char **argv)
        * environment list shall not exceed {ARG_MAX}-2048 bytes.  It also 
        * specifies that it shall be at least LINE_MAX.
        */
-#if defined(ARG_MAX)
+#ifdef _SC_ARG_MAX  
+      long val = sysconf(_SC_ARG_MAX);
+      if (val > 0)
+	{
+	  /* Note that val can in fact be greater than ARG_MAX
+	   * and bc_ctl.arg_max can also be greater than ARG_MAX.
+	   */
+	  assert(bc_ctl.arg_max <= (val-2048));
+	}
+      else
+	{
+# if defined(ARG_MAX)
+	  assert(bc_ctl.arg_max <= (ARG_MAX-2048));
+# endif
+	}
+#else
+      /* No _SC_ARG_MAX */
       assert(bc_ctl.arg_max <= (ARG_MAX-2048));
 #endif
+
+
 #ifdef LINE_MAX
       assert(bc_ctl.arg_max >= LINE_MAX);
 #endif
