diff options
author | Eric Blake <ebb9@byu.net> | 2009-11-12 10:19:39 -0700 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-11-13 07:39:56 -0700 |
commit | 6e4b15b5ee28b52b4a03c74fe8a9ac9bc8a976ea (patch) | |
tree | 60e9911fe45923bfaa4a562268ab26a0979f3ee9 /m4/getgroups.m4 | |
parent | 61b3a42219dc8f575923346b59162f81186b7425 (diff) | |
download | gnulib-6e4b15b5ee28b52b4a03c74fe8a9ac9bc8a976ea.tar.gz |
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>
Diffstat (limited to 'm4/getgroups.m4')
-rw-r--r-- | m4/getgroups.m4 | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4 index 1dd39eacce..4d9671247f 100644 --- a/m4/getgroups.m4 +++ b/m4/getgroups.m4 @@ -1,4 +1,4 @@ -# serial 13 +# serial 14 dnl From Jim Meyering. dnl A wrapper around AC_FUNC_GETGROUPS. @@ -17,7 +17,8 @@ AC_DEFUN([gl_FUNC_GETGROUPS], if test "$ac_cv_func_getgroups" != yes; then AC_LIBOBJ([getgroups]) HAVE_GETGROUPS=0 - elif test "$ac_cv_func_getgroups_works" != yes; then + elif test "$ac_cv_func_getgroups_works.$ac_cv_type_getgroups" != yes.gid_t + then AC_LIBOBJ([getgroups]) REPLACE_GETGROUPS=1 fi |