summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2005-12-26 03:51:24 +0000
committerSteve Peters <steve@fisharerojo.org>2005-12-26 03:51:24 +0000
commit331b57bcdc85be353c262edb0595869ccbf0c8b5 (patch)
tree95083618860311a2484523d934052e35a3775ffd /doio.c
parent39a108ce50cdda5b6c5584d8056cebaacd441121 (diff)
downloadperl-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.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/doio.c b/doio.c
index 4015d17149..4c913d868f 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;