From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 2 10:26:34 2007 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 15A6116A40F for ; Tue, 2 Jan 2007 10:26:34 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from turion.vk2pj.dyndns.org (c58-107-94-118.belrs4.nsw.optusnet.com.au [58.107.94.118]) by mx1.freebsd.org (Postfix) with ESMTP id 945DD13C44B for ; Tue, 2 Jan 2007 10:26:33 +0000 (UTC) (envelope-from peterjeremy@optushome.com.au) Received: from turion.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1]) by turion.vk2pj.dyndns.org (8.13.8/8.13.8) with ESMTP id l029kcri001658; Tue, 2 Jan 2007 20:46:38 +1100 (EST) (envelope-from peter@turion.vk2pj.dyndns.org) Received: (from peter@localhost) by turion.vk2pj.dyndns.org (8.13.8/8.13.8/Submit) id l029kcY2001657; Tue, 2 Jan 2007 20:46:38 +1100 (EST) (envelope-from peter) Date: Tue, 2 Jan 2007 20:46:38 +1100 From: Peter Jeremy To: Vulpes Velox Message-ID: <20070102094637.GA836@turion.vk2pj.dyndns.org> References: <20070101233525.0b10a1e2@vixen42> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: <20070101233525.0b10a1e2@vixen42> X-PGP-Key: http://members.optusnet.com.au/peterjeremy/pubkey.asc User-Agent: Mutt/1.5.13 (2006-08-11) Cc: freebsd-hackers@freebsd.org Subject: Re: getgroups and getgrouplist functions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jan 2007 10:26:34 -0000 --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--