diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-06-30 02:05:28 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-06-30 02:05:28 +0000 |
commit | e5125a2406cb25f415acb1a11d14e6e53cda219b (patch) | |
tree | ca094ec35885c0106e0edb4d661521440037d33f /ext | |
parent | cc7dda15db83aa13fa105ec91670c456402ee1f5 (diff) | |
download | perl-e5125a2406cb25f415acb1a11d14e6e53cda219b.tar.gz |
localize %INC in a Safe compartment so that use/require work
(many other magic globals probably need similar treatment)
p4raw-id: //depot/perl@6285
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Opcode/Opcode.xs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 581cbc94d9..e191ec7c9c 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -250,7 +250,7 @@ PPCODE: save_aptr(&PL_endav); PL_endav = (AV*)sv_2mortal((SV*)newAV()); /* ignore END blocks for now */ - save_hptr(&PL_defstash); /* save current default stack */ + save_hptr(&PL_defstash); /* save current default stash */ /* the assignment to global defstash changes our sense of 'main' */ PL_defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already */ save_hptr(&PL_curstash); @@ -263,6 +263,10 @@ PPCODE: sv_free((SV*)GvHV(gv)); GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash); + /* %INC must be clean for use/require in compartment */ + save_hash(PL_incgv); + GvHV(PL_incgv) = (HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpv("INC",TRUE,SVt_PVHV)))); + PUSHMARK(SP); perl_call_sv(codesv, GIMME|G_EVAL|G_KEEPERR); /* use callers context */ SPAGAIN; /* for the PUTBACK added by xsubpp */ |