summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2010-10-24 14:57:21 +0100
committerFather Chrysostomos <sprout@cpan.org>2010-10-24 11:40:00 -0700
commit8f89e5a94a208b4017fb2fb80d6a0e23cd552ed9 (patch)
tree908f1376e69a56debccf3bfbc36f5cbd37743312 /pp_sys.c
parentccbfef1989966a87df0683fb781de40d0fad1f84 (diff)
downloadperl-8f89e5a94a208b4017fb2fb80d6a0e23cd552ed9.tar.gz
don't rely on ghost contexts being unmolested
Dying and returning from a format both relied on the state of a just-popped context frame being preserved across a LEAVE. Don't rely on it. Test using an operator ripped off from Scope::Cleanup, which makes it easy to run arbitrary Perl code during cleanup, without isolating it on a separate context stack as the DESTROY mechanism does.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 39daad6880..78b635f05d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1348,6 +1348,7 @@ PP(pp_leavewrite)
SV **newsp;
I32 gimme;
register PERL_CONTEXT *cx;
+ OP *retop;
if (!io || !(ofp = IoOFP(io)))
goto forget_top;
@@ -1428,6 +1429,7 @@ PP(pp_leavewrite)
forget_top:
POPBLOCK(cx,PL_curpm);
POPFORMAT(cx);
+ retop = cx->blk_sub.retop;
LEAVE;
fp = IoOFP(io);
@@ -1460,7 +1462,7 @@ PP(pp_leavewrite)
PUTBACK;
PERL_UNUSED_VAR(newsp);
PERL_UNUSED_VAR(gimme);
- return cx->blk_sub.retop;
+ return retop;
}
PP(pp_prtf)