summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-09 05:05:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-09 05:05:43 +0000
commit582b7e1ca9b1fe56516d84698cbfaad7ee317bad (patch)
treecebd5826b7c41ea010f560d69504b1e94d5fc981 /eval.c
parent894d8d9e618d352a1a54f19210f6e1d99d18cdd8 (diff)
* eval.c (rb_set_end_proc, rb_exec_end_proc): restore safe level.
[ruby-dev:21557] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 9d3ce0867a..edb488b595 100644
--- a/eval.c
+++ b/eval.c
@@ -6406,6 +6406,7 @@ NORETURN(static VALUE rb_f_throw _((int,VALUE*)));
struct end_proc_data {
void (*func)();
VALUE data;
+ int safe;
struct end_proc_data *next;
};
@@ -6424,6 +6425,7 @@ rb_set_end_proc(func, data)
link->next = *list;
link->func = func;
link->data = data;
+ link->safe = ruby_safe_level;
*list = link;
}
@@ -6489,6 +6491,7 @@ rb_exec_end_proc()
{
struct end_proc_data *link, *tmp;
int status;
+ volatile int safe = ruby_safe_level;
while (ephemeral_end_procs) {
link = ephemeral_end_procs;
@@ -6496,6 +6499,7 @@ rb_exec_end_proc()
while (link) {
PUSH_TAG(PROT_NONE);
if ((status = EXEC_TAG()) == 0) {
+ ruby_safe_level = link->safe;
(*link->func)(link->data);
}
POP_TAG();
@@ -6513,6 +6517,7 @@ rb_exec_end_proc()
while (link) {
PUSH_TAG(PROT_NONE);
if ((status = EXEC_TAG()) == 0) {
+ ruby_safe_level = link->safe;
(*link->func)(link->data);
}
POP_TAG();
@@ -6524,6 +6529,7 @@ rb_exec_end_proc()
free(tmp);
}
}
+ ruby_safe_level = safe;
}
void