search for: group_array

Displaying 2 results from an estimated 2 matches for "group_array".

2020 Mar 28
0
[klibc:update-dash] dash: builtin: Use test_access from NetBSD when faccessat is unavailable
...if (st->st_uid == euid) - mode <<= 6; - else if (bash_group_member(st->st_gid)) - mode <<= 3; - - return st->st_mode & mode; -} - -/* Return non-zero if GID is one that we have in our groups list. */ -static int -bash_group_member(gid_t gid) -{ - register int i; - gid_t *group_array; - int ngroups; - - /* Short-circuit if possible, maybe saving a call to getgroups(). */ - if (gid == getgid() || gid == getegid()) - return (1); - - ngroups = getgroups(0, NULL); - group_array = stalloc(ngroups * sizeof(gid_t)); - if ((getgroups(ngroups, group_array)) != ngroups) - return (0); -...
2007 Aug 23
0
[git patch] klibc dash 0.5.4 update
...g.au> Signed-off-by: maximilian attems <max at stro.at> diff --git a/usr/dash/bltin/test.c b/usr/dash/bltin/test.c index 77949de..8f9e085 100644 --- a/usr/dash/bltin/test.c +++ b/usr/dash/bltin/test.c @@ -489,7 +489,8 @@ bash_group_member(gid_t gid) ngroups = getgroups(0, NULL); group_array = stalloc(ngroups * sizeof(gid_t)); - getgroups(ngroups, group_array); + if ((getgroups(ngroups, group_array)) != ngroups) + return (0); /* Search through the list looking for GID. */ for (i = 0; i < ngroups; i++) diff --git a/usr/dash/mkinit.c b/usr/dash/mkinit.c index e803751..9714bee 1...