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;
}
That sounds great. I think error_handling should be to just return 2 in
this case.
and perhaps if n is big enough qsort groups array and use
a binary search instead of linear one.
Are there systems where there are users that are in more than 20 groups?
(Just wondering. ;))
Roland
_______________________________________________
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel