diff options
author | Steve Peters <steve@fisharerojo.org> | 2005-12-26 03:51:24 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2005-12-26 03:51:24 +0000 |
commit | 331b57bcdc85be353c262edb0595869ccbf0c8b5 (patch) | |
tree | 95083618860311a2484523d934052e35a3775ffd /doio.c | |
parent | 39a108ce50cdda5b6c5584d8056cebaacd441121 (diff) | |
download | perl-331b57bcdc85be353c262edb0595869ccbf0c8b5.tar.gz |
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
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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; |