In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/fb4089e0451edf57bb8c2f8e853074872a4ac7d3?hp=0abd0d78a73da1c4d13b1c700526b7e5d03b32d4>

- Log -----------------------------------------------------------------
commit fb4089e0451edf57bb8c2f8e853074872a4ac7d3
Author: [email protected] <[email protected]>
Date:   Fri Oct 23 08:20:38 2009 -0700

    mg.c uses a fixed NGROUPS contant
    
    # New Ticket Created by  [email protected]
    # 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 [email protected],
    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
-----------------------------------------------------------------------

Summary of changes:
 mg.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/mg.c b/mg.c
index 05f8cd9..aaed62d 100644
--- a/mg.c
+++ b/mg.c
@@ -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))

--
Perl5 Master Repository

Reply via email to