diff options
author | Ulrich Drepper <drepper@redhat.com> | 2010-11-22 11:15:08 -0500 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2010-11-22 11:15:08 -0500 |
commit | eaca75697fdc5c21195935eca2f0b149a75c0316 (patch) | |
tree | 4596fbb80f4ac56fce322ebac3ae80ac81e3d640 | |
parent | 3056dcdb783a177158a5617657d1a33f872358d6 (diff) | |
download | glibc-eaca75697fdc5c21195935eca2f0b149a75c0316.tar.gz glibc-eaca75697fdc5c21195935eca2f0b149a75c0316.tar.xz glibc-eaca75697fdc5c21195935eca2f0b149a75c0316.zip |
Optimize last initgroups patch a bit.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | nis/nss_compat/compat-initgroups.c | 24 |
2 files changed, 17 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index 66bc545f00..daf74ddfc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-11-22 Ulrich Drepper <drepper@gmail.com> + + * nis/nss_compat/compat-initgroups.c (internal_getgrent_r): Optimize + last patch a bit. Pretty printing + 2010-05-31 Petr Baudis <pasky@suse.cz> [BZ #10085] diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c index de8d95c7d1..caff38f9cc 100644 --- a/nis/nss_compat/compat-initgroups.c +++ b/nis/nss_compat/compat-initgroups.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998-2004, 2006, 2007, 2009 Free Software Foundation, Inc. +/* Copyright (C) 1998-2004,2006,2007,2009,2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998. @@ -288,12 +288,12 @@ getgrent_next_nss (ent_t *ent, char *buffer, size_t buflen, const char *user, return NSS_STATUS_TRYAGAIN; /* For every gid in the list we get from the NSS module, - get the whole group entry. We need to do this, since we - need the group name to check if it is in the blacklist. - In worst case, this is as twice as slow as stepping with - getgrent_r through the whole group database. But for large - group databases this is faster, since the user can only be - in a limited number of groups. */ + get the whole group entry. We need to do this, since we + need the group name to check if it is in the blacklist. + In worst case, this is as twice as slow as stepping with + getgrent_r through the whole group database. But for large + group databases this is faster, since the user can only be + in a limited number of groups. */ if (nss_initgroups_dyn (user, group, &mystart, &mysize, &mygroups, limit, errnop) == NSS_STATUS_SUCCESS) { @@ -426,7 +426,7 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user, } while (*p == '\0' || *p == '#' || /* Ignore empty and comment lines. */ /* Parse the line. If it is invalid, loop to - get the next line of the file to parse. */ + get the next line of the file to parse. */ !(parse_res = _nss_files_parse_grent (p, &grpbuf, data, buflen, errnop))); @@ -477,15 +477,15 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user, if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL) { if (nss_setgrent != NULL) - { + { nss_setgrent (1); ent->need_endgrent = true; } ent->skip_initgroups_dyn = true; - } - if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL) - return NSS_STATUS_UNAVAIL; + if (nss_getgrent_r == NULL) + return NSS_STATUS_UNAVAIL; + } ent->files = false; |