summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/cgi/session.rb2
-rw-r--r--lib/cgi/session/pstore.rb3
-rw-r--r--lib/date.rb2
-rw-r--r--lib/debug.rb4
4 files changed, 7 insertions, 4 deletions
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index a44de7cb81d..0bc10d013fc 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -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))
diff --git a/lib/cgi/session/pstore.rb b/lib/cgi/session/pstore.rb
index 8f4beb978a9..f46dd57392c 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -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.
diff --git a/lib/date.rb b/lib/date.rb
index b8c15a420a4..3e3e33de7aa 100644
--- a/lib/date.rb
+++ b/lib/date.rb
@@ -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)
diff --git a/lib/debug.rb b/lib/debug.rb
index 0a105abab82..1b12188a76e 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -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+/