Re: getgrouplist(3) vs. getgroups(3)

2005-07-23 Thread Roland Illig
Pavel Tsekov wrote: On Fri, 22 Jul 2005, Roland Illig wrote: I updated the patch. Seems nice. How about removing the configure bits related to getgrouplist() too ? Done in PRE. Roland ___ Mc-devel mailing list

getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
Why do we use getgrouplist(3) at all? What we're interested in are the permissions of the current process, not what's in the system-wide database. Roland ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
Roland Illig wrote: Why do we use getgrouplist(3) at all? What we're interested in are the permissions of the current process, not what's in the system-wide database. After applying this patch, everything works as usual. Why have we used a GTree for storing the group IDs of the process? In my

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
Roland Illig wrote: Roland Illig wrote: Why do we use getgrouplist(3) at all? What we're interested in are the permissions of the current process, not what's in the system-wide database. After applying this patch, everything works as usual. and here's a more readable variant of the

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Pavel Tsekov
Hello, On Fri, 22 Jul 2005, Roland Illig wrote: Roland Illig wrote: Why do we use getgrouplist(3) at all? What we're interested in are the permissions of the current process, not what's in the system-wide database. This question seems reasonable. After applying this patch, everything

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Jakub Jelinek
On Fri, Jul 22, 2005 at 10:23:27AM +0200, Roland Illig wrote: +/* Return the index of the permissions triplet */ +int +get_user_permissions (struct stat *buf) { +static gboolean initialized = FALSE; +static gid_t groups[NGROUPS_MAX]; NGROUPS_MAX can be fairly large, plus it is max

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
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)

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
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)

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Pavel Tsekov
On Fri, 22 Jul 2005, Roland Illig wrote: I updated the patch. Seems nice. How about removing the configure bits related to getgrouplist() too ? ___ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
Pavel Tsekov wrote: On Fri, 22 Jul 2005, Roland Illig wrote: I updated the patch. Seems nice. How about removing the configure bits related to getgrouplist() too ? That's obvious. ;) Roland ___ Mc-devel mailing list

Re: getgrouplist(3) vs. getgroups(3)

2005-07-22 Thread Roland Illig
Roland Illig wrote: +if (!initialized) { + uid = getuid (); + ngroups = getgroups (0, NULL); + if (ngroups != -1) { /* allocate space for one more element * than will be filled by getgroups(). */ + groups = g_new (gid_t, ngroups + 1); +