aboutsummaryrefslogtreecommitdiff
path: root/grp
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-30 18:23:15 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-30 18:23:15 +0000
commitff0913d3a334d61b20f8e91fdee7ac87ff03aa15 (patch)
tree7e4ab1baf6221907f4cc27c0588c6a303a972809 /grp
parent3b0b6c369ff4067f9ae9ee1d1c8adbc2039079c6 (diff)
downloadglibc-ff0913d3a334d61b20f8e91fdee7ac87ff03aa15.tar
glibc-ff0913d3a334d61b20f8e91fdee7ac87ff03aa15.tar.gz
glibc-ff0913d3a334d61b20f8e91fdee7ac87ff03aa15.tar.bz2
glibc-ff0913d3a334d61b20f8e91fdee7ac87ff03aa15.zip
Update.
2004-03-30 Ulrich Drepper <drepper@redhat.com> * nis/nss_nis/nis-initgroups.c: Implement getting the information from the netid.byname map if the system administrator allows this. * grp/initgroups.c (initgroups): Limit the initial allocation to 64 entries to not allocate too much on systems with really high limits.
Diffstat (limited to 'grp')
-rw-r--r--grp/initgroups.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 4b19594833..858dd314e5 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989,91,93,1996-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1989,91,93,1996-2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -249,12 +249,11 @@ initgroups (const char *user, gid_t group)
long int limit = __sysconf (_SC_NGROUPS_MAX);
if (limit > 0)
- size = limit;
+ /* We limit the size of the intially allocated array. */
+ size = MIN (limit, 64);
else
- {
- /* No fixed limit on groups. Pick a starting buffer size. */
- size = 16;
- }
+ /* No fixed limit on groups. Pick a starting buffer size. */
+ size = 16;
groups = (gid_t *) malloc (size * sizeof (gid_t));
if (__builtin_expect (groups == NULL, 0))