diff options
author | perlbug-followup@perl.org <perlbug-followup@perl.org> | 2009-10-23 08:20:38 -0700 |
---|---|---|
committer | Andy Dougherty <doughera@lafayette.edu> | 2009-10-26 12:42:07 -0400 |
commit | fb4089e0451edf57bb8c2f8e853074872a4ac7d3 (patch) | |
tree | d9019ba3fec3b6372bd3a5b344bcb6037164ba1d /mg.c | |
parent | 0abd0d78a73da1c4d13b1c700526b7e5d03b32d4 (diff) | |
download | perl-fb4089e0451edf57bb8c2f8e853074872a4ac7d3.tar.gz |
mg.c uses a fixed NGROUPS contant
# New Ticket Created by casper.dik@sun.com
# Please include the string: [perl #69977]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=69977 >
This is a bug report for perl from casper.dik@sun.com,
generated with the help of perlbug 1.36 running under perl 5.10.0.
-----------------------------------------------------------------
[Please enter your report here]
In mg.c NGROUPS is defined as follows:
#if defined(HAS_SETGROUPS)
# ifndef NGROUPS
# define NGROUPS 32
# endif
#endif
and uses it later here:
2632 #ifdef HAS_SETGROUPS
2633 {
2634 const char *p = SvPV_const(sv, len);
2635 Groups_t *gary = NULL;
2636
2637 while (isSPACE(*p))
2638 ++p;
2639 PL_egid = Atol(p);
2640 for (i = 0; i < NGROUPS; ++i) {
2641 while (*p && !isSPACE(*p))
2642 ++p;
2643 while (isSPACE(*p))
2644 ++p;
2645 if (!*p)
2646 break;
2647 if(!gary)
2648 Newx(gary, i + 1, Groups_t);
2649 else
2650 Renew(gary, i + 1, Groups_t);
2651 gary[i] = Atol(p);
2652 }
2653 if (i)
2654 (void)setgroups(i, gary);
2655 Safefree(gary);
2656 }
2657 #else /* HAS_SETGROUPS */
This should be changed as follows
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2667,11 +2667,19 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) { const char *p = SvPV_const(sv, len); Groups_t *gary = NULL; +#ifdef _SC_NGROUPS_MAX + int maxgrp = sysconf(_SC_NGROUPS_MAX); + + if (maxgrp < 0) + maxgrp = NGROUPS; +#else + int maxgrp = NGROUPS; +#endif while (isSPACE(*p)) ++p; PL_egid = Atol(p); - for (i = 0; i < NGROUPS; ++i) { + for (i = 0; i < maxgrp; ++i) { while (*p && !isSPACE(*p)) ++p; while (isSPACE(*p)) |