diff options
author | Jim Cromie <jcromie@cpan.org> | 2005-12-23 06:24:29 -0700 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2005-12-24 03:30:02 +0000 |
commit | 57d7c65eded7a5f963c5ce38ee196978a06e35df (patch) | |
tree | 9abf188bda32fa0c6831eb7f2bf5536c48342764 /mg.c | |
parent | ae052913d35fc9a3eba38f8fe345d776f2522568 (diff) | |
download | perl-57d7c65eded7a5f963c5ce38ee196978a06e35df.tar.gz |
Re: [perl #37907] Perl_magic_get reqires ridiculous amounts of stackmemory
Message-ID: <43AC5CFD.3060200@gmail.com>
Includes a change in variable names from "j" to "num_groups".
p4raw-id: //depot/perl@26480
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1006,10 +1006,14 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) add_groups: #ifdef HAS_GETGROUPS { - Groups_t gary[NGROUPS]; - I32 j = getgroups(NGROUPS,gary); - while (--j >= 0) - Perl_sv_catpvf(aTHX_ sv, " %"Gid_t_f, (long unsigned int)gary[j]); + Groups_t *gary = NULL; + I32 num_groups = getgroups(0, gary); + Newx(gary, num_groups, Groups_t); + num_groups = getgroups(num_groups, gary); + while (--num_groups >= 0) + Perl_sv_catpvf(aTHX_ sv, " %"Gid_t_f, + (long unsigned int)gary[num_groups]); + Safefree(gary); } #endif (void)SvIOK_on(sv); /* what a wonderful hack! */ |