getgrouplist(3) vs. getgroups(3)

Roland Illig roland.illig at gmx.de
Fri Jul 22 09:55:30 UTC 2005


Jakub Jelinek wrote:
> But, IMHO far better would be to:
> static gid_t *groups;
> if (!groups) {
>   uid = getuid ();
>   n = getgroups (0, NULL);
>   if (n < 0) error_handling;
>   groups = malloc (n * sizeof (gid_t));
>   if (groups == NULL) error_handling;
>   n = getgroups (n, groups);
>   if (n < 0) error_handling;
> }

I updated the patch.

Roland
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: getgroups.patch
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20050722/9f140786/attachment.ksh>


More information about the mc-devel mailing list