mgetgroups: add xgetgroups, and avoid ENOSYS failures
ENOSYS implies that there are no supplemental groups, so we can
treat it the same as a return of 0 from getgroups rather than
exposing failure to the user. This in turn fixes a crash in
coreutils' id, which freed an uninitialized pointer.
* lib/mgetgroups.h (xgetgroups): New prototype.
* lib/mgetgroups.c (xgetgroups): New wrapper.
(mgetgroups): Handle ENOSYS.
* modules/mgetgroups (Depends-on): Add realloc.
Reported by Scott Harrison <scott.gnu.2009@scottrix.co.uk>.
Signed-off-by: Eric Blake <ebb9@byu.net>