summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-11-25 20:52:17 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-11-25 20:52:17 +0000
commitc3564e5c35b594706ecb001261b86a47fb837059 (patch)
tree924db2bde875fbdf39afd6a16feea1b1c79b944a /pp_ctl.c
parentcf829ab07ccc67cf02ca41d6f870136b64d83833 (diff)
downloadperl-c3564e5c35b594706ecb001261b86a47fb837059.tar.gz
C<foreach my $x ...> in pseudo-fork()ed process may diddle
parent's memory; fix it by keeping track of the actual pad offset rather than a raw pointer (this change is probably also relevant to non-ithreads case to avoid fallout from reallocs of the pad array, but is currently only enabled for the ithreads case in the interests of minimal disruption to existing "well tested" code) p4raw-id: //depot/perl@7858
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 2b217dd059..d22f2efc0f 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1776,9 +1776,11 @@ PP(pp_enteriter)
else
#endif /* USE_THREADS */
if (PL_op->op_targ) {
+#ifndef USE_ITHREADS
svp = &PL_curpad[PL_op->op_targ]; /* "my" variable */
SAVESPTR(*svp);
-#ifdef USE_ITHREADS
+#else
+ SAVEPADSV(PL_op->op_targ);
iterdata = (void*)PL_op->op_targ;
cxtype |= CXp_PADVAR;
#endif