Skip to content

Commit

Permalink
Simplified the logic for detecting the number of groups
Browse files Browse the repository at this point in the history
  • Loading branch information
ysyrota authored and AaronAtDuo committed Oct 18, 2024
1 parent bbec1e2 commit 30662aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compat/groupaccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ ga_init(const char *user, gid_t base)
#else
ngroups = NGROUPS_MAX;
# if defined(HAVE_SYSCONF) && defined(_SC_NGROUPS_MAX)
# ifndef MAX
# define MAX(a,b) (((a)>(b))?(a):(b))
# endif
ngroups = MAX(NGROUPS_MAX, sysconf(_SC_NGROUPS_MAX));
long sys_ngroups_max = sysconf(_SC_NGROUPS_MAX);
if (sys_ngroups_max > NGROUPS_MAX) {
ngroups = sys_ngroups_max;
}
# endif
#endif

Expand Down

0 comments on commit 30662aa

Please sign in to comment.