summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-04-04 00:00:00 +0000
committerChip Salzenberg <chip@atlantic.net>1997-04-04 00:00:00 +0000
commit5cd24f17b72b10f8506d70fba1ec4dd25224c257 (patch)
tree0016ef5cb000e60fd3ea5ca5acf14ab3fa5a9812 /mg.c
parentdaff0e373f3630eaa9dbded0adcc04185f454487 (diff)
downloadperl-5cd24f17b72b10f8506d70fba1ec4dd25224c257.tar.gz
[inseparable changes from match from perl-5.003_97a to perl-5.003_97b]
BUILD PROCESS Subject: Don't suggest 'Configure -der' in config.sh comments From: Chip Salzenberg <chip@perl.com> Files: Configure CORE LANGUAGE CHANGES Subject: Make assignment to C<$)> call setgroups() From: Chip Salzenberg <chip@perl.com> Files: Configure config_H config_h.SH mg.c plan9/config.plan9 pod/perldelta.pod vms/config.vms win32/config.H win32/config.w32 Subject: Grandfather "$$<digit>" in strings From: Chip Salzenberg <chip@perl.com> Files: pod/perldiag.pod toke.c Subject: Disconnect warn and die hooks _after_ object destruction From: Chip Salzenberg <chip@perl.com> Files: perl.c Subject: Forbid recursive substitutions From: Chip Salzenberg <chip@perl.com> Files: cop.h pod/perldelta.pod pod/perldiag.pod pp_ctl.c pp_hot.c DOCUMENTATION Subject: Document required module versions From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod LIBRARY AND EXTENSIONS Subject: Updates to Math::Complex and Math::Trig From: Jarkko Hietaniemi <Jarkko.Hietaniemi@cc.hut.fi> Files: lib/Math/Complex.pm lib/Math/Trig.pm pod/perldelta.pod t/lib/complex.t OTHER CORE CHANGES Subject: length($') isn't Date: Mon, 07 Apr 1997 03:30:44 -0400 From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: mg.c Msg-ID: 199704070730.DAA07310@aatma.engin.umich.edu (applied based on p5p patch as commit 645a7cbb1f14932f058231f0a4f808b88ebe8703) Subject: Fix obscure regex bug related to leading C<.*> From: Chip Salzenberg <chip@perl.com> Files: toke.c Subject: Add warning for glob failure From: Chip Salzenberg <chip@perl.com> Files: pod/perldelta.pod pod/perldiag.pod pp_hot.c Subject: Fix C<perl -V> in presence of local patches From: Chip Salzenberg <chip@perl.com> Files: perl.c
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index f1dc828029..54ca0442c3 100644
--- a/mg.c
+++ b/mg.c
@@ -20,7 +20,7 @@
# include <unistd.h>
#endif
-#ifdef HAS_GETGROUPS
+#if defined(HAS_GETGROUPS) || defined(HAS_SETGROUPS)
# ifndef NGROUPS
# define NGROUPS 32
# endif
@@ -307,7 +307,7 @@ MAGIC *mg;
if (rx->subend && (s = rx->endp[0])) {
i = rx->subend - s;
if (i >= 0)
- return 0;
+ return i;
}
}
return 0;
@@ -1518,7 +1518,29 @@ MAGIC* mg;
tainting |= (uid && (euid != uid || egid != gid));
break;
case ')':
+#ifdef HAS_SETGROUPS
+ {
+ char *p = SvPV(sv, na);
+ Groups_t gary[NGROUPS];
+
+ SET_NUMERIC_STANDARD();
+ while (isSPACE(*p))
+ ++p;
+ egid = I_V(atof(p));
+ for (i = 0; i < NGROUPS; ++i) {
+ while (*p && !isSPACE(*p))
+ ++p;
+ while (isSPACE(*p))
+ ++p;
+ if (!*p)
+ break;
+ gary[i] = I_V(atof(p));
+ }
+ (void)setgroups(i, gary);
+ }
+#else /* HAS_SETGROUPS */
egid = SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv);
+#endif /* HAS_SETGROUPS */
if (delaymagic) {
delaymagic |= DM_EGID;
break; /* don't do magic till later */