Date: Tue, 2 Jan 2007 20:46:38 +1100 From: Peter Jeremy <peterjeremy@optushome.com.au> To: Vulpes Velox <v.velox@vvelox.net> Cc: freebsd-hackers@freebsd.org Subject: Re: getgroups and getgrouplist functions Message-ID: <20070102094637.GA836@turion.vk2pj.dyndns.org> In-Reply-To: <20070101233525.0b10a1e2@vixen42> References: <20070101233525.0b10a1e2@vixen42>
next in thread | previous in thread | raw e-mail | index | archive | help
--DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. --=20 Peter Jeremy --DocE+STaALJfprDB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFFmin9/opHv/APuIcRAkRWAKCn/UggfIdmlArDxGjI1Rw1/XlppACgr1zg Tejf79n+FZspPg5Xb7gqeLs= =zyOa -----END PGP SIGNATURE----- --DocE+STaALJfprDB--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070102094637.GA836>