Re: getgroups and getgrouplist functions
- From: Vulpes Velox <v.velox@xxxxxxxxxx>
- Date: Tue, 2 Jan 2007 14:53:36 -0600
On Tue, 2 Jan 2007 20:46:38 +1100
Peter Jeremy <peterjeremy@xxxxxxxxxxxxxxxx> wrote:
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.
I am not reading at always in this case. The man pages for other
systems do specify always, but a bit iffy here. From testing it
appears it is not set and ngroups is left alone if it is to small. I
found it is set to the number if that number is less than the initial
ngroups value. So far I know NetBSD, glibc, and what ever Mac uses
makes the change.
I am lost on if this is a bug or if FreeBSD is not following some
standard in regards to this.
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.
Yeah. The patch I made for DBus last uses this upon failing the first
time.
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- References:
- getgroups and getgrouplist functions
- From: Vulpes Velox
- Re: getgroups and getgrouplist functions
- From: Peter Jeremy
- getgroups and getgrouplist functions
- Prev by Date: Re: Doubts with scheduler code
- Next by Date: Re: Interesting TCP issue
- Previous by thread: Re: getgroups and getgrouplist functions
- Next by thread: Doubts with scheduler code
- Index(es):