getgroups: don't expose GETGROUPS_T to user
authorEric Blake <ebb9@byu.net>
Thu, 12 Nov 2009 17:19:39 +0000 (10:19 -0700)
committerEric Blake <ebb9@byu.net>
Fri, 13 Nov 2009 14:39:56 +0000 (07:39 -0700)
commit6e4b15b5ee28b52b4a03c74fe8a9ac9bc8a976ea
tree60e9911fe45923bfaa4a562268ab26a0979f3ee9
parent61b3a42219dc8f575923346b59162f81186b7425
getgroups: don't expose GETGROUPS_T to user

These days, most systems already declare getgroups with gid_t*.
But in the rare case that GETGROUPS_T is still int but gid_t
is short, the user should not have to uglify their code; let
the replacement hide all the magic.

Tested by configuring with ac_cv_type_getgroups=uint64_t on a
platform with 32-bit gid_t, and ignoring compiler warnings.

However, since we don't replace setgroups, the GETGROUPS_T
workaround is still needed there for now.

* lib/getgroups.c (rpl_getgroups): Change signature.  Copy array
an element at a time if GETGROUPS_T is wrong size.
* lib/getugroups.h (getugroups): Change signature.
* lib/unistd.in.h (getgroups): Likewise.
* m4/getgroups.m4 (gl_FUNC_GETGROUPS): Use replacement if
signature needs fixing.
* m4/getugroups.m4 (gl_GETUGROUPS): No longer need
AC_TYPE_GETGROUPS.
* modules/group-member (Depends-on): Add getgroups.
* lib/group-member.c (group_info, get_group_info): Use gid_t.
(group_member): Rely on getgroups replacement.
* lib/getugroups.c (getugroups): Use gid_t.
* tests/test-getgroups.c (main): Likewise.
* NEWS: Mention the signature change.
* doc/posix-functions/getgroups.texi (getgroups): Mention the
problem with signature.
* doc/glibc-functions/setgroups.texi (setgroups): Mention that
GETGROUPS_T is still useful for setgroups.

Signed-off-by: Eric Blake <ebb9@byu.net>
13 files changed:
ChangeLog
NEWS
doc/glibc-functions/setgroups.texi
doc/posix-functions/getgroups.texi
lib/getgroups.c
lib/getugroups.c
lib/getugroups.h
lib/group-member.c
lib/unistd.in.h
m4/getgroups.m4
m4/getugroups.m4
modules/group-member
tests/test-getgroups.c