summaryrefslogtreecommitdiff
path: root/which.c
diff options
context:
space:
mode:
authorToby Goodwin <tjg@star.le.ac.uk>2003-08-13 13:51:14 +0100
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:22:10 +0100
commitd884971193ef4934424b77ae862e8b0ecf70bab3 (patch)
tree700b8fd63be483aaa2a737036a3f7833fdf7b26a /which.c
parent77b18786228a8cf9f58aee09677440c61dc218a9 (diff)
release: rc-1.7.1
Diffstat (limited to 'which.c')
-rw-r--r--which.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/which.c b/which.c
index 9a6e1bb..8abdc60 100644
--- a/which.c
+++ b/which.c
@@ -37,6 +37,8 @@ static int ingidset(gid_t g) {
return 1;
return 0;
}
+#else
+#define ingidset(g) (FALSE)
#endif
/*
@@ -56,11 +58,7 @@ static bool rc_access(char *path, bool verbose) {
mask = X_ALL;
else if (uid == st.st_uid)
mask = X_USR;
-#if HAVE_GETGROUPS
else if (gid == st.st_gid || ingidset(st.st_gid))
-#else
- else if (gid == st.st_gid)
-#endif
mask = X_GRP;
else
mask = X_OTH;
@@ -93,10 +91,12 @@ extern char *which(char *name, bool verbose) {
rc_exit(1);
}
#else
- ngroups = NGROUPS;
+ ngroups = NGROUPS;
#endif
- gidset = ealloc(ngroups * sizeof(GETGROUPS_T));
- getgroups(ngroups, gidset);
+ if (ngroups) {
+ gidset = ealloc(ngroups * sizeof(GETGROUPS_T));
+ getgroups(ngroups, gidset);
+ }
#endif
}
if (isabsolute(name)) /* absolute pathname? */