aboutsummaryrefslogtreecommitdiff
path: root/libbb/bb_getgroups.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2024-10-07 06:36:00 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2024-10-07 06:36:00 +0200
commit4c1d645c86f4e7a380d96f9ba962f8b270f595dc (patch)
tree365585f77fc146545119c17250eff32a61f2718c /libbb/bb_getgroups.c
parent860b3d066f6aaa12dfa0cd2351559e05288cf9b5 (diff)
downloadbusybox-w32-4c1d645c86f4e7a380d96f9ba962f8b270f595dc.tar.gz
busybox-w32-4c1d645c86f4e7a380d96f9ba962f8b270f595dc.tar.bz2
busybox-w32-4c1d645c86f4e7a380d96f9ba962f8b270f595dc.zip
libbb: simplify parameter passing in is_in_supplementary_groups()
function old new delta is_in_supplementary_groups 54 52 -2 nexpr 721 718 -3 test_exec 125 119 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-11) Total: -11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/bb_getgroups.c')
-rw-r--r--libbb/bb_getgroups.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libbb/bb_getgroups.c b/libbb/bb_getgroups.c
index f030d5eac..d9bbe95c3 100644
--- a/libbb/bb_getgroups.c
+++ b/libbb/bb_getgroups.c
@@ -47,16 +47,16 @@ gid_t* FAST_FUNC bb_getgroups(int *ngroups, gid_t *group_array)
47} 47}
48 48
49/* Return non-zero if GID is in our supplementary group list. */ 49/* Return non-zero if GID is in our supplementary group list. */
50int FAST_FUNC is_in_supplementary_groups(int *pngroups, gid_t **pgroup_array, gid_t gid) 50int FAST_FUNC is_in_supplementary_groups(struct cached_groupinfo *groupinfo, gid_t gid)
51{ 51{
52 int i; 52 int i;
53 int ngroups; 53 int ngroups;
54 gid_t *group_array; 54 gid_t *group_array;
55 55
56 if (*pngroups == 0) 56 if (groupinfo->ngroups == 0)
57 *pgroup_array = bb_getgroups(pngroups, NULL); 57 groupinfo->supplementary_array = bb_getgroups(&groupinfo->ngroups, NULL);
58 ngroups = *pngroups; 58 ngroups = groupinfo->ngroups;
59 group_array = *pgroup_array; 59 group_array = groupinfo->supplementary_array;
60 60
61 /* Search through the list looking for GID. */ 61 /* Search through the list looking for GID. */
62 for (i = 0; i < ngroups; i++) 62 for (i = 0; i < ngroups; i++)