Mercurial > hg > octave-jordi > gnulib-hg
diff lib/mgetgroups.c @ 18029:e4a13d95b503
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.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 28 Jun 2015 23:43:35 -0700 |
parents | ab58d4870664 |
children | cbcda721f9b4 |
line wrap: on
line diff
--- a/lib/mgetgroups.c +++ b/lib/mgetgroups.c @@ -64,6 +64,11 @@ gid_t *g; #if HAVE_GETGROUPLIST +# if HAVE_GETGROUPLIST_WITH_INT +# define getgrouplist_gids(g) ((int *) (g)) +# else +# define getgrouplist_gids(g) (g) +# endif /* We prefer to use getgrouplist if available, because it has better performance characteristics. @@ -87,7 +92,8 @@ int last_n_groups = max_n_groups; /* getgrouplist updates max_n_groups to num required. */ - ng = getgrouplist (username, gid, g, &max_n_groups); + ng = getgrouplist (username, gid, getgrouplist_gids (g), + &max_n_groups); /* Some systems (like Darwin) have a bug where they never increase max_n_groups. */