summary refs log tree commit diff
path: root/grp/initgroups.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-04-17 03:34:20 +0000
committerRoland McGrath <roland@gnu.org>2001-04-17 03:34:20 +0000
commit3de33da93f439dfdcb447e25e4f84ee733e04f77 (patch)
tree0a76c3680888c16faef1ee9fe4029e6d2686b7c3 /grp/initgroups.c
parentcb21f2421208c0c4bc1df0d6be7fcd786f2a51ed (diff)
downloadglibc-3de33da93f439dfdcb447e25e4f84ee733e04f77.tar.gz
glibc-3de33da93f439dfdcb447e25e4f84ee733e04f77.tar.xz
glibc-3de33da93f439dfdcb447e25e4f84ee733e04f77.zip
* grp/initgroups.c (initgroups) [NGROUPS_MAX != 0]: Always use sysconf
	instead of the constant NGROUPS_MAX.  That way, the limit can be
	raised in the kernel configuration without having to recompile libc.

	* sysdeps/posix/euidaccess.c: Don't #include <limits.h> or try to
	define NGROUPS_MAX; we don't use it here.
Diffstat (limited to 'grp/initgroups.c')
-rw-r--r--grp/initgroups.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 6ae73687fe..89dc4d64fc 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 91, 93, 1996-1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1989,91,93,1996-1999,2000,01 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
@@ -158,21 +158,21 @@ initgroups (user, group)
   /* Start is one, because we have the first group as parameter.  */
   long int start = 1;
   long int size;
-  long int limit;
   gid_t *groups;
   int result;
-#ifdef NGROUPS_MAX
-  size = NGROUPS_MAX;
-  limit = -1;
-#else
+
+  /* We always use sysconf even if NGROUPS_MAX is defined.  That way, the
+     limit can be raised in the kernel configuration without having to
+     recompile libc.  */
   long int limit = __sysconf (_SC_NGROUPS_MAX);
 
   if (limit > 0)
     size = limit;
   else
-    /* No fixed limit on groups.  Pick a starting buffer size.  */
-    size = 16;
-#endif
+    {
+      /* 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))