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>
* 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>
* lib/webrick/httpservlet/cgihandler.rb

View file

@ -1147,14 +1147,14 @@ rb_sys_warning(fmt, va_alist)
void
rb_load_fail(path)
char *path;
const char *path;
{
rb_loaderror("%s -- %s", strerror(errno), path);
}
void
rb_error_frozen(what)
char *what;
const char *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
rb_thread_sleep_forever()
{
int thr_critical = rb_thread_critical;
if (curr_thread == curr_thread->next ||
curr_thread->status == THREAD_TO_KILL) {
rb_thread_critical = Qtrue;
TRAP_BEG;
pause();
rb_thread_critical = thr_critical;
TRAP_END;
return;
}

10
gc.c
View file

@ -1685,8 +1685,6 @@ undefine_final(os, obj)
return obj;
}
#define NODE_FINAL NODE_LIT
/*
* call-seq:
* ObjectSpace.define_finalizer(obj, aProc=proc())
@ -1715,7 +1713,7 @@ define_final(argc, argv, os)
need_call_final = 1;
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) {
finalizer_table = st_init_numtable();
@ -1768,9 +1766,9 @@ run_final(obj)
}
if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
NODE *final = (NODE *)RARRAY(table)->ptr[i];
args[0] = final->nd_lit;
args[2] = final->nd_nth;
VALUE final = RARRAY(table)->ptr[i];
args[0] = FIX2INT(RARRAY(final)->ptr[0]);
args[2] = RARRAY(final)->ptr[1];
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*)));
void rb_compile_error __((const char*, ...));
void rb_compile_error_append __((const char*, ...));
NORETURN(void rb_load_fail _((char*)));
NORETURN(void rb_error_frozen _((char*)));
NORETURN(void rb_load_fail _((const char*)));
NORETURN(void rb_error_frozen _((const char*)));
void rb_check_frozen _((VALUE));
/* eval.c */
RUBY_EXTERN struct RNode *ruby_current_node;
@ -381,8 +381,8 @@ const char* rb_get_kcode _((void));
/* ruby.c */
RUBY_EXTERN VALUE rb_argv;
RUBY_EXTERN VALUE rb_argv0;
void rb_load_file _((char*));
void ruby_script _((char*));
void rb_load_file _((const char*));
void ruby_script _((const char*));
void ruby_prog_init _((void));
void ruby_set_argv _((int, char**));
void ruby_process_options _((int, char**));

View file

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

View file

@ -70,6 +70,9 @@ class CGI
@hash = {}
end
@p = ::PStore.new(path)
@p.transaction do |p|
File.chmod(0600, p.path)
end
end
# 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}
private :__#{id.to_i}__
def #{id.to_s}(*args, &block)
if @__#{id.to_i}__
if defined? @__#{id.to_i}__
@__#{id.to_i}__
elsif ! self.frozen?
@__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block)

View file

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

8
ruby.c
View file

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