getgroups and getgrouplist functions

Peter Jeremy peterjeremy at optushome.com.au
Tue Jan 2 02:26:34 PST 2007


On Mon, 2007-Jan-01 23:35:25 -0600, Vulpes Velox wrote:
>I am reading it as int *ngroups is not set to the number of groups in
>the list if the number of groups is larger than the number specified.

I read getgrouplist(3) as stating that it will always return the
actual number of groups via ngroups.  The code in RELENG_6 actually
returns the number of groups that are returned via groups - which is
never be greater than was passed in.  I believe that the manpage does
not match the implementation but I am not certain which is correct.

>convinced this is a load of bull. And the proper way to get the
>number of groups some one is in is to call getgroups(0).

At least in RELENG_6, getgroups(2) states that passing the first
argument as 0 will return the number of groups: getgroups(0, NULL);
This matches the code in the kernel.

-- 
Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20070102/c35cba21/attachment.pgp


More information about the freebsd-hackers mailing list