Hey,

While having a hard time to sleep, I started to read obscure bits of
code in coreutils.  And found this funny compiler error in
[kernel]/lib/getgroups.c at line 51:

      /* No need to worry about address arithmetic overflow here,
         since the ancient systems that we're running on have low
         limits on the number of secondary groups.  */
      gbuf = xmalloc (gbuf, n * sizeof *gbuf);

I suppose that nobody has ever used that code, since compiling would
catch the fact that xmalloc only takes one argument! :-)

Anyway, here is a patch to fix it.

2003-12-03  Alfred M. Szmidt  <[EMAIL PROTECTED]>

        * getgroups.c (getgroups): Fix typo.

--- lib/getgroups.c.~1.10.~     2003-11-02 21:29:34.000000000 +0100
+++ lib/getgroups.c     2003-12-03 01:54:30.000000000 +0100
@@ -48,7 +48,7 @@ getgroups (int n, GETGROUPS_T *group)
       /* No need to worry about address arithmetic overflow here,
         since the ancient systems that we're running on have low
         limits on the number of secondary groups.  */
-      gbuf = xmalloc (gbuf, n * sizeof *gbuf);
+      gbuf = xnmalloc ((GETGROUPS_T) gbuf, n * sizeof *gbuf);
       n_groups = getgroups (n, gbuf);
       if (n_groups < n)
        break;


_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to