summaryrefslogtreecommitdiffstats
path: root/eval_load.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-21 00:14:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-02-21 00:14:07 +0000
commite390141af710552713cb89c3c44ba900c29701e2 (patch)
treeedf0c7a7ae3bc0a7bb30f5677422d1024d24be24 /eval_load.c
parent8ca16efb921b966987a9b25ac764dda027d2dab1 (diff)
downloadruby-e390141af710552713cb89c3c44ba900c29701e2.tar.gz
ruby-e390141af710552713cb89c3c44ba900c29701e2.tar.xz
ruby-e390141af710552713cb89c3c44ba900c29701e2.zip
* eval_load.c (rb_require_safe): should restore safe level.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval_load.c')
-rw-r--r--eval_load.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/eval_load.c b/eval_load.c
index 2048ea36b..321fc3109 100644
--- a/eval_load.c
+++ b/eval_load.c
@@ -370,9 +370,15 @@ rb_require_safe(VALUE fname, int safe)
volatile VALUE errinfo = GET_THREAD()->errinfo;
rb_thread_t *th = GET_THREAD();
int state;
+ struct {
+ NODE *node;
+ int safe;
+ } volatile saved;
char *volatile ftptr = 0;
PUSH_TAG(PROT_NONE);
+ saved.node = ruby_current_node;
+ saved.safe = rb_safe_level();
if ((state = EXEC_TAG()) == 0) {
VALUE path;
long handle;
@@ -422,6 +428,8 @@ rb_require_safe(VALUE fname, int safe)
free(ftptr);
}
}
+ ruby_current_node = saved.node;
+ rb_set_safe_level_force(saved.safe);
if (state) {
JUMP_TAG(state);
}