From 7296487f1486aa5f541cfaf105c25ab169dc59ec Mon Sep 17 00:00:00 2001 From: Yuriy Syrota Date: Fri, 18 Oct 2024 17:10:07 +0300 Subject: [PATCH] Simplified the logic for detecting the number of groups --- compat/groupaccess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compat/groupaccess.c b/compat/groupaccess.c index 4d0f8da..863bc7f 100644 --- a/compat/groupaccess.c +++ b/compat/groupaccess.c @@ -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