From: Gisle Aas Date: Wed, 11 Jan 2006 20:50:30 +0000 (+0000) Subject: Make $( and $) list the groups in the order they X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb45abb286e885c11569ca1f9190bd239b0f0319;p=p5sagit%2Fp5-mst-13.2.git Make $( and $) list the groups in the order they are returned from the OS. Linux seems to return the gids sorted and it seemed wrong for perl to reverse this order. p4raw-id: //depot/perl@26791 --- diff --git a/mg.c b/mg.c index 51655af..9ba8d10 100644 --- a/mg.c +++ b/mg.c @@ -1011,12 +1011,11 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) #ifdef HAS_GETGROUPS { Groups_t *gary = NULL; - I32 num_groups = getgroups(0, gary); + I32 i, 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, " %"IVdf, - (IV)gary[num_groups]); + for (i = 0; i < num_groups; i++) + Perl_sv_catpvf(aTHX_ sv, " %"IVdf, (IV)gary[i]); Safefree(gary); } (void)SvIOK_on(sv); /* what a wonderful hack! */