From f4ec483382e167469def497422dbb30fee5f5f32 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 31 Oct 2011 16:48:45 -0400 Subject: 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. --- nss/getent.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nss/getent.c') 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; -- cgit v1.2.3