changeset 18031:e856c8618738

mgetgroups: fix port to strict OS X * m4/mgetgroups.m4 (gl_MGETGROUPS): Use more-sensitive -Werror setting if available.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 29 Jun 2015 19:12:07 -0700
parents bbdce0795bb7
children cbcda721f9b4
files ChangeLog m4/mgetgroups.m4
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-06-29  Paul Eggert  <eggert@cs.ucla.edu>
+
+	mgetgroups: port to strict OS X
+	* doc/glibc-functions/getgrouplist.texi (getgrouplist):
+	Document the getgrouplist problem.
+	* lib/mgetgroups.c (getgrouplist_gids) [HAVE_GETGROUPLIST]:
+	New macro.
+	(mgetgroups): Use it.
+	* m4/mgetgroups.m4 (gl_MGETGROUPS):
+	Check for OS X signature for getgrouplist.
+
 2015-06-29  Jim Meyering  <meyering@fb.com>
 
 	linkat: fix invalid definition of LINKAT_SYMLINK_NOTSUP on OS X
--- a/m4/mgetgroups.m4
+++ b/m4/mgetgroups.m4
@@ -1,4 +1,4 @@
-#serial 6
+#serial 7
 dnl Copyright (C) 2007-2015 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,6 +12,8 @@
     AC_CACHE_CHECK([for getgrouplist with int signature],
       [gl_cv_getgrouplist_with_int],
       [gl_cv_getgrouplist_with_int=no
+       gl_save_c_werror_flag=$ac_c_werror_flag
+       ac_c_werror_flag=yes
        AC_COMPILE_IFELSE(
          [AC_LANG_PROGRAM(
             [[#if HAVE_GRP_H
@@ -19,11 +21,8 @@
               #endif
               int groups[1];
               int ngroups = 1;
-              int getgrouplist (char const *, gid_t, gid_t *, int *);
             ]],
-            [[
-              return - getgrouplist ("root", 0, groups, &ngroups);
-            ]])],
+            [[return - getgrouplist ("root", 0, groups, &ngroups);]])],
          [],
          [AC_COMPILE_IFELSE(
            [AC_LANG_PROGRAM(
@@ -32,12 +31,10 @@
                 #endif
                 int groups[sizeof (gid_t) == sizeof (int) ? 1 : -1];
                 int ngroups = 1;
-                int getgrouplist (char const *, int, int *, int *);
               ]],
-              [[
-                return - getgrouplist ("root", 0, groups, &ngroups);
-              ]])],
-            [gl_cv_getgrouplist_with_int=yes])])])
+              [[return - getgrouplist ("root", 0, groups, &ngroups);]])],
+            [gl_cv_getgrouplist_with_int=yes])])
+       ac_c_werror_flag=$gl_save_c_werror_flag])
     if test "$gl_cv_getgrouplist_with_int" = yes; then
       AC_DEFINE([HAVE_GETGROUPLIST_WITH_INT], 1,
         [Define to 1 if getgrouplist accepts and returns int and not gid_t.])