diff options
| author | tgoodwin <tgoodwin> | 1998-07-27 13:26:37 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:11 +0100 |
| commit | d3102fa7de519677c917beb108a71b81ef9a8abc (patch) | |
| tree | 2b30aa4eddaf1f9913fe7e2d1f480c67605465c8 /which.c | |
| parent | 8a11028b592d1c7a5b408475fdc3028b04ab6ffa (diff) | |
add RC_FUNC_GETGROUPS configure magic
Diffstat (limited to 'which.c')
| -rw-r--r-- | which.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -8,10 +8,12 @@ and to strip out unneeded functionality. */ -#include "rc.h" #include <errno.h> #include <sys/stat.h> +#include "rc.h" +#include "getgroups.h" + #define X_USR 0100 #define X_GRP 0010 #define X_OTH 0001 @@ -83,7 +85,15 @@ extern char *which(char *name, bool verbose) { uid = geteuid(); gid = getegid(); #if HAVE_GETGROUPS +#if HAVE_POSIX_GETGROUPS ngroups = getgroups(0, (GETGROUPS_T *)0); + if (ngroups < 0) { + uerror("getgroups"); + rc_exit(1); + } +#else + ngroups = NGROUPS; +#endif gidset = ealloc(ngroups * sizeof(GETGROUPS_T)); getgroups(ngroups, gidset); #endif |