From: Steve Peters Date: Mon, 26 Dec 2005 03:51:24 +0000 (+0000) Subject: Obviously, Perl_ingroup() is also using 256k of stack memory on Linux. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=331b57bcdc85be353c262edb0595869ccbf0c8b5;p=p5sagit%2Fp5-mst-13.2.git Obviously, Perl_ingroup() is also using 256k of stack memory on Linux. Adapt change #26480 to reduce memory usage here as well. p4raw-link: @26480 on //depot/perl: 57d7c65eded7a5f963c5ce38ee196978a06e35df p4raw-id: //depot/perl@26486 --- diff --git a/doio.c b/doio.c index 4015d17..4c913d8 100644 --- a/doio.c +++ b/doio.c @@ -1932,13 +1932,21 @@ Perl_ingroup(pTHX_ Gid_t testgid, bool effective) #define NGROUPS 32 #endif { - Groups_t gary[NGROUPS]; + Groups_t *gary = NULL; I32 anum; + bool rc = FALSE; - anum = getgroups(NGROUPS,gary); + anum = getgroups(0, gary); + Newx(gary, anum, Groups_t); + anum = getgroups(anum, gary); while (--anum >= 0) - if (gary[anum] == testgid) - return TRUE; + if (gary[anum] == testgid) { + rc = TRUE; + break; + } + + Safefree(gary); + return rc; } #endif return FALSE;