1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* gc.c (define_final): should not disclose NODE* to Ruby world.

[ruby-dev:23957]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2004-07-23 07:52:38 +00:00
parent a32c01d85a
commit ca14017bb6
10 changed files with 37 additions and 20 deletions

View file

@ -1,7 +1,20 @@
Fri Jul 23 16:40:25 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (define_final): should not disclose NODE* to Ruby world.
[ruby-dev:23957]
Fri Jul 23 08:52:22 2004 Shugo Maeda <shugo@ruby-lang.org> Fri Jul 23 08:52:22 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (disconnected?): new method. * lib/net/imap.rb (disconnected?): new method.
Thu Jul 22 16:41:54 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi/session.rb (CGI::Session::FileStore#update): sets the
permission of the session data file to 0600.
* lib/cgi/session/pstore.rb (CGI::Session::Pstore#initialize):
ditto.
Mon Jul 19 00:53:46 2004 GOTOU Yuuzou <gotoyuzo@notwork.org> Mon Jul 19 00:53:46 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick/httpservlet/cgihandler.rb * lib/webrick/httpservlet/cgihandler.rb

View file

@ -1147,14 +1147,14 @@ rb_sys_warning(fmt, va_alist)
void void
rb_load_fail(path) rb_load_fail(path)
char *path; const char *path;
{ {
rb_loaderror("%s -- %s", strerror(errno), path); rb_loaderror("%s -- %s", strerror(errno), path);
} }
void void
rb_error_frozen(what) rb_error_frozen(what)
char *what; const char *what;
{ {
rb_raise(rb_eTypeError, "can't modify frozen %s", what); rb_raise(rb_eTypeError, "can't modify frozen %s", what);
} }

3
eval.c
View file

@ -10971,10 +10971,13 @@ rb_thread_sleep(sec)
void void
rb_thread_sleep_forever() rb_thread_sleep_forever()
{ {
int thr_critical = rb_thread_critical;
if (curr_thread == curr_thread->next || if (curr_thread == curr_thread->next ||
curr_thread->status == THREAD_TO_KILL) { curr_thread->status == THREAD_TO_KILL) {
rb_thread_critical = Qtrue;
TRAP_BEG; TRAP_BEG;
pause(); pause();
rb_thread_critical = thr_critical;
TRAP_END; TRAP_END;
return; return;
} }

10
gc.c
View file

@ -1685,8 +1685,6 @@ undefine_final(os, obj)
return obj; return obj;
} }
#define NODE_FINAL NODE_LIT
/* /*
* call-seq: * call-seq:
* ObjectSpace.define_finalizer(obj, aProc=proc()) * ObjectSpace.define_finalizer(obj, aProc=proc())
@ -1715,7 +1713,7 @@ define_final(argc, argv, os)
need_call_final = 1; need_call_final = 1;
FL_SET(obj, FL_FINALIZE); FL_SET(obj, FL_FINALIZE);
block = (VALUE)rb_node_newnode(NODE_FINAL, block, ruby_safe_level, 0); block = rb_ary_new3(2, INT2FIX(ruby_safe_level), block);
if (!finalizer_table) { if (!finalizer_table) {
finalizer_table = st_init_numtable(); finalizer_table = st_init_numtable();
@ -1768,9 +1766,9 @@ run_final(obj)
} }
if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) { if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) { for (i=0; i<RARRAY(table)->len; i++) {
NODE *final = (NODE *)RARRAY(table)->ptr[i]; VALUE final = RARRAY(table)->ptr[i];
args[0] = final->nd_lit; args[0] = FIX2INT(RARRAY(final)->ptr[0]);
args[2] = final->nd_nth; args[2] = RARRAY(final)->ptr[1];
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status); rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
} }
} }

View file

@ -143,8 +143,8 @@ NORETURN(void rb_name_error __((ID, const char*, ...)));
NORETURN(void rb_invalid_str _((const char*, const char*))); NORETURN(void rb_invalid_str _((const char*, const char*)));
void rb_compile_error __((const char*, ...)); void rb_compile_error __((const char*, ...));
void rb_compile_error_append __((const char*, ...)); void rb_compile_error_append __((const char*, ...));
NORETURN(void rb_load_fail _((char*))); NORETURN(void rb_load_fail _((const char*)));
NORETURN(void rb_error_frozen _((char*))); NORETURN(void rb_error_frozen _((const char*)));
void rb_check_frozen _((VALUE)); void rb_check_frozen _((VALUE));
/* eval.c */ /* eval.c */
RUBY_EXTERN struct RNode *ruby_current_node; RUBY_EXTERN struct RNode *ruby_current_node;
@ -381,8 +381,8 @@ const char* rb_get_kcode _((void));
/* ruby.c */ /* ruby.c */
RUBY_EXTERN VALUE rb_argv; RUBY_EXTERN VALUE rb_argv;
RUBY_EXTERN VALUE rb_argv0; RUBY_EXTERN VALUE rb_argv0;
void rb_load_file _((char*)); void rb_load_file _((const char*));
void ruby_script _((char*)); void ruby_script _((const char*));
void ruby_prog_init _((void)); void ruby_prog_init _((void));
void ruby_set_argv _((int, char**)); void ruby_set_argv _((int, char**));
void ruby_process_options _((int, char**)); void ruby_process_options _((int, char**));

View file

@ -395,7 +395,7 @@ class CGI
def update def update
return unless @hash return unless @hash
begin begin
f = File.open(@path, 'w') f = File.open(@path, File::CREAT|File::TRUNC|File::RDWR, 0600)
f.flock File::LOCK_EX f.flock File::LOCK_EX
for k,v in @hash for k,v in @hash
f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v)) f.printf "%s=%s\n", CGI::escape(k), CGI::escape(String(v))

View file

@ -70,6 +70,9 @@ class CGI
@hash = {} @hash = {}
end end
@p = ::PStore.new(path) @p = ::PStore.new(path)
@p.transaction do |p|
File.chmod(0600, p.path)
end
end end
# Restore session state from the session's PStore file. # Restore session state from the session's PStore file.

View file

@ -711,7 +711,7 @@ class Date
alias_method :__#{id.to_i}__, :#{id.to_s} alias_method :__#{id.to_i}__, :#{id.to_s}
private :__#{id.to_i}__ private :__#{id.to_i}__
def #{id.to_s}(*args, &block) def #{id.to_s}(*args, &block)
if @__#{id.to_i}__ if defined? @__#{id.to_i}__
@__#{id.to_i}__ @__#{id.to_i}__
elsif ! self.frozen? elsif ! self.frozen?
@__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block) @__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block)

View file

@ -189,10 +189,10 @@ class Context
def debug_variable_info(input, binding) def debug_variable_info(input, binding)
case input case input
when /^\s*g(?:lobal)?$/ when /^\s*g(?:lobal)?\s*$/
var_list(global_variables, binding) var_list(global_variables, binding)
when /^\s*l(?:ocal)?$/ when /^\s*l(?:ocal)?\s*$/
var_list(eval("local_variables", binding), binding) var_list(eval("local_variables", binding), binding)
when /^\s*i(?:nstance)?\s+/ when /^\s*i(?:nstance)?\s+/

8
ruby.c
View file

@ -61,7 +61,7 @@ extern int ruby_yydebug;
char *ruby_inplace_mode = Qfalse; char *ruby_inplace_mode = Qfalse;
static void load_stdin _((void)); static void load_stdin _((void));
static void load_file _((char *, int)); static void load_file _((const char *, int));
static void forbid_setid _((const char *)); static void forbid_setid _((const char *));
static VALUE do_loop = Qfalse, do_print = Qfalse; static VALUE do_loop = Qfalse, do_print = Qfalse;
@ -801,7 +801,7 @@ extern int ruby__end__seen;
static void static void
load_file(fname, script) load_file(fname, script)
char *fname; const char *fname;
int script; int script;
{ {
extern VALUE rb_stdin; extern VALUE rb_stdin;
@ -924,7 +924,7 @@ load_file(fname, script)
void void
rb_load_file(fname) rb_load_file(fname)
char *fname; const char *fname;
{ {
load_file(fname, 0); load_file(fname, 0);
} }
@ -1010,7 +1010,7 @@ set_arg0(val, id)
void void
ruby_script(name) ruby_script(name)
char *name; const char *name;
{ {
if (name) { if (name) {
rb_progname = rb_tainted_str_new2(name); rb_progname = rb_tainted_str_new2(name);