Hello, on a system with 75.000 users and 3.800 groups the mc start takes about 2 minutes. With the attached patch it takes only 1 second.
MC Version 4.6.0-pre1 Platform: Debian Greetings Stefan -- Stefan Gohmann <[EMAIL PROTECTED]> fon: +49 421 22 232- 0 Entwicklung Linux for Your Business Univention GmbH http://www.univention.de/ fax: +49 421 22 232-99
--- mc-4.6.0-4.6.1-pre1.orig/src/utilunix.c Fri Nov 28 16:23:19 2003 +++ mc-4.6.0-4.6.1-pre1/src/utilunix.c Tue Nov 16 10:15:30 2004 @@ -88,7 +88,7 @@ g_strdup (grp->gr_name)); } - setgrent (); + /*setgrent (); while ((grp = getgrent ()) != NULL) { for (i = 0; grp->gr_mem[i]; i++) { if (!strcmp (pwd->pw_name, grp->gr_mem[i]) && @@ -101,7 +101,36 @@ } } } - endgrent (); + endgrent ();*/ + gid_t *groups = NULL; + int ng = 1; + //struct group *grp; + gid_t *newgroups = NULL; + + groups = (gid_t *) malloc(ng * sizeof(gid_t)); + + if (getgrouplist(pwd->pw_name, pwd->pw_gid, groups, &ng) == -1) { + newgroups = (gid_t *) malloc(ng * sizeof(gid_t)); + if (newgroups != NULL) { + free(groups); + groups = newgroups; + getgrouplist(pwd->pw_name, pwd->pw_gid, groups, &ng); + } else ng = 1; + } + + for (i = 0; i < ng; i++) { + grp = getgrgid(groups[i]); + if (grp != NULL && + !g_tree_lookup (current_user_gid, + GUINT_TO_POINTER ((int) grp->gr_gid))) { + g_tree_insert (current_user_gid, + GUINT_TO_POINTER ((int) grp->gr_gid), + g_strdup (grp->gr_name)); + } + } + + free(groups); + } /* Return the index of the permissions triplet */
_______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel