[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[coreutils]/lib/getgroups.c, xmalloc usage...
From: |
Alfred M. Szmidt |
Subject: |
[coreutils]/lib/getgroups.c, xmalloc usage... |
Date: |
Wed, 3 Dec 2003 10:53:24 +0100 (MET) |
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 <address@hidden>
* 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;
- [coreutils]/lib/getgroups.c, xmalloc usage...,
Alfred M. Szmidt <=