summaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-05 11:23:19 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-05 11:23:19 +0000
commit09c3bcb4adf312661293d6e41a52a572f6db8241 (patch)
treed9185beca616a817aee1c07223e2dac0bff91657 /nscd
parentfd63f7c6ce353ccfdbba58a37e8ef5465fcedfe4 (diff)
downloadglibc-09c3bcb4adf312661293d6e41a52a572f6db8241.tar.gz
Fix s390{,x} build. grouplist fixes from Ulrich.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/initgrcache.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index 124b4bae62..9ba7b89bdf 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -117,6 +117,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
/* Nothing added yet. */
while (! no_more)
{
+ long int prev_start = start;
enum nss_status status;
initgroups_dyn_function fct;
fct = __nss_lookup_function (nip, "initgroups_dyn");
@@ -133,6 +134,21 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
status = DL_CALL_FCT (fct, (key, -1, &start, &size, &groups,
limit, &errno));
+ /* Remove duplicates. */
+ long int cnt = prev_start;
+ while (cnt < start)
+ {
+ long int inner;
+ for (inner = 0; inner < prev_start; ++inner)
+ if ((*groupsp)[inner] == (*groups)[cnt])
+ break;
+
+ if (inner < prev_start)
+ ++cnt;
+ else
+ (*groupsp)[cnt] = (*groupsp)[--start];
+ }
+
if (status != NSS_STATUS_TRYAGAIN)
all_tryagain = false;