about summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-31 16:48:45 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-31 16:48:45 -0400
commitf4ec483382e167469def497422dbb30fee5f5f32 (patch)
tree2706e91b09ed2a560dc89cd8ce0bd78eeecbafac /nss
parent0ffc4f3ebaace42cd545db55a2ac50b6e0cc7d89 (diff)
downloadglibc-f4ec483382e167469def497422dbb30fee5f5f32.tar.gz
glibc-f4ec483382e167469def497422dbb30fee5f5f32.tar.xz
glibc-f4ec483382e167469def497422dbb30fee5f5f32.zip
Unify getent output for initgroups database
Requests for other fail if iteration is not supported and no parameters
are given.  Do this for initgroups as well.
Diffstat (limited to 'nss')
-rw-r--r--nss/getent.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/nss/getent.c b/nss/getent.c
index 7d9422373c..0e39836179 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -518,6 +518,12 @@ initgroups_keys (int number, char *key[])
   size_t grpslen = ngrps * sizeof (gid_t);
   gid_t *grps = alloca (grpslen);
 
+  if (number == 0)
+    {
+      fprintf (stderr, _("Enumeration not supported on %s\n"), "initgroups");
+      return 3;
+    }
+
   for (int i = 0; i < number; ++i)
     {
       int no = ngrps;