Hi,

>>>>> On Sat, 27 Oct 2007 22:36:45 +0200
>>>>> Tomas Janousek <[EMAIL PROTECTED]> said:

tjanouse> Hi,

tjanouse> On Sun, Oct 28, 2007 at 02:35:05AM +0900, Hajimu UMEMOTO wrote:
> tjanouse> Yes. It should read "ret == -1 && ngroups != newstate->ngroups". 
> I'm really
> tjanouse> confused why I put the "ret != -1" in there.
> 
> As far as I read the FreeBSD's getgrouplist() implementation, when it
> returns -1, the number of the groups actually filled is set to
> ngroups.  It is match with the following description in the manpage:
> 
>   RETURN VALUES
>      The getgrouplist() function returns -1 if the size of the group list is
>      too small to hold all the user's groups.  Here, the group array will be
>      filled with as many groups as will fit.

tjanouse> The manpage says that "the actual number of groups found is returned 
in
tjanouse> ngroups."  My understanding may be bad and/or they may have 
implemented
tjanouse> something else than they say in the manpage/than what I understand, 
though.
tjanouse> But I think this part of behaviour is really the same.  If you really 
think
tjanouse> this is not what happens, I will check the sources.

It seems to me from the source of getgrouplist() that it sets "the
actual number of groups found" to ngroups only when it returns 0.
When it returns -1, "the number of groups actually filled" is set to
ngroups.  I think that it is what the RETURN VALUES section in
FreeBSD's manpage says.
So, I think that "ret == -1 && ngroups != newstate->ngroups" would be
always FALSE at least on FreeBSD.

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
[EMAIL PROTECTED]  [EMAIL PROTECTED],jp.}FreeBSD.org
http://www.imasy.org/~ume/
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

Reply via email to