summaryrefslogtreecommitdiff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-01 21:37:29 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-01 21:37:29 +0000
commit6d96590587deec027c04fe576f11cff0f445eb32 (patch)
treea0b964a672b5e970d88a8f030da837ce14885aae /nscd
parentb7a09b9201b09b722209cb430813709505927be0 (diff)
downloadglibc-6d96590587deec027c04fe576f11cff0f445eb32.tar.gz
Updated to fedora-glibc-20041001T2134cvs/fedora-glibc-2_3_3-63
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd_initgroups.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/nscd/nscd_initgroups.c b/nscd/nscd_initgroups.c
index ea32ab6bcc..d6cb00000e 100644
--- a/nscd/nscd_initgroups.c
+++ b/nscd/nscd_initgroups.c
@@ -95,6 +95,7 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
doesn't use memcpy but instead copies each array element one
by one. */
assert (sizeof (int32_t) == sizeof (gid_t));
+ assert (initgr_resp->ngrps > 0);
/* Make sure we have enough room. We always count GROUP in even
though we might not end up adding it. */
@@ -125,25 +126,21 @@ __nscd_getgrouplist (const char *user, gid_t group, long int *size,
retval = initgr_resp->ngrps;
memcpy (*groupsp, respdata, retval * sizeof (gid_t));
}
-
- /* Check whether GROUP is part of the mix. If not, add it. */
- if (retval >= 0)
- {
- int cnt;
- for (cnt = 0; cnt < retval; ++cnt)
- if ((*groupsp)[cnt] == group)
- break;
-
- if (cnt == retval)
- (*groupsp)[retval++] = group;
- }
}
else
+ /* No group found yet. */
+ retval = 0;
+
+ /* Check whether GROUP is part of the mix. If not, add it. */
+ if (retval >= 0)
{
- /* The `errno' to some value != ERANGE. */
- __set_errno (ENOENT);
- /* Even though we have not found anything, the result is zero. */
- retval = 0;
+ int cnt;
+ for (cnt = 0; cnt < retval; ++cnt)
+ if ((*groupsp)[cnt] == group)
+ break;
+
+ if (cnt == retval)
+ (*groupsp)[retval++] = group;
}
if (sock != -1)