Fail gracefully if getgroups() fails

Jordan Crouse jordan.crouse at amd.com
Tue Aug 22 20:43:14 UTC 2006


On 22/08/06 22:32 +0200, Peter S. Mazinger wrote:
> On Tue, 22 Aug 2006, Jordan Crouse wrote:
> 
> > uClibc is pretty stuck on using legacy 16 bit UIDs.  So when one turns off
> > CONFIG_UID16 in the Linux kernel, some syscalls have the annoying tendency to
> > return an error when they aren't normally expected to, including getgroups().  
> > 
> > The following patch makes coreutils/test.c act fail gracefully if getgroups() 
> > returns a -1.  This fixes a problem on the One Laptop Per Child ROM image
> > whereby we were getting odd Memory exhausted messages for '[' and 'test'.
> > 
> > Found by Mitch Bradley <wmb at firmworks.com>
> 
> could it be, that uClibc was built with MALLOC_GLIBC_MALLOC disabled?
> I have seen "Memory exhausted" many times if that option is disabled.

Well, possibly, but its just not proper programming to be passing in a
negative size to realloc() regardless of how tolerant a glibc-like 
realloc() might be.

Jordan

-- 
Jordan Crouse
Senior Linux Engineer
Advanced Micro Devices, Inc.
<www.amd.com/embeddedprocessors>





More information about the busybox mailing list