mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/cgi/session.rb (CGI::Session::FileStore::restore): use
lockfile for exclusive locks. a patch from <tommy AT tmtm.org>. [ruby-dev:32296] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
54ee97d731
commit
2d1ccd3826
3 changed files with 21 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Thu Nov 15 12:19:14 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/cgi/session.rb (CGI::Session::FileStore::restore): use
|
||||||
|
lockfile for exclusive locks. a patch from <tommy AT tmtm.org>.
|
||||||
|
[ruby-dev:32296]
|
||||||
|
|
||||||
Wed Nov 14 01:52:59 2007 Tanaka Akira <akr@fsij.org>
|
Wed Nov 14 01:52:59 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* missing/isinf.c (isinf): don't define if the macro is defined.
|
* missing/isinf.c (isinf): don't define if the macro is defined.
|
||||||
|
|
|
@ -397,8 +397,9 @@ class CGI
|
||||||
unless @hash
|
unless @hash
|
||||||
@hash = {}
|
@hash = {}
|
||||||
begin
|
begin
|
||||||
|
lockf = File.open(@path+".lock", "r")
|
||||||
|
lockf.flock File::LOCK_SH
|
||||||
f = File.open(@path, 'r')
|
f = File.open(@path, 'r')
|
||||||
f.flock File::LOCK_SH
|
|
||||||
for line in f
|
for line in f
|
||||||
line.chomp!
|
line.chomp!
|
||||||
k, v = line.split('=',2)
|
k, v = line.split('=',2)
|
||||||
|
@ -406,6 +407,7 @@ class CGI
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
f.close unless f.nil?
|
f.close unless f.nil?
|
||||||
|
lockf.close if lockf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@hash
|
@hash
|
||||||
|
@ -415,13 +417,17 @@ class CGI
|
||||||
def update
|
def update
|
||||||
return unless @hash
|
return unless @hash
|
||||||
begin
|
begin
|
||||||
f = File.open(@path, File::CREAT|File::TRUNC|File::RDWR, 0600)
|
lockf = File.open(@path+".lock", File::CREAT|File::RDWR, 0600)
|
||||||
f.flock File::LOCK_EX
|
lockf.flock File::LOCK_EX
|
||||||
|
f = File.open(@path+".new", File::CREAT|File::TRUNC|File::WRONLY, 0600)
|
||||||
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))
|
||||||
end
|
end
|
||||||
|
f.close
|
||||||
|
File.rename @path+".new", @path
|
||||||
ensure
|
ensure
|
||||||
f.close unless f.nil?
|
f.close if f and !f.closed?
|
||||||
|
lockf.close if lockf
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -432,6 +438,8 @@ class CGI
|
||||||
|
|
||||||
# Close and delete the session's FileStore file.
|
# Close and delete the session's FileStore file.
|
||||||
def delete
|
def delete
|
||||||
|
File::unlink @path+".lock" rescue nil
|
||||||
|
File::unlink @path+".new" rescue nil
|
||||||
File::unlink @path
|
File::unlink @path
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#define RUBY_VERSION "1.8.6"
|
#define RUBY_VERSION "1.8.6"
|
||||||
#define RUBY_RELEASE_DATE "2007-11-14"
|
#define RUBY_RELEASE_DATE "2007-11-15"
|
||||||
#define RUBY_VERSION_CODE 186
|
#define RUBY_VERSION_CODE 186
|
||||||
#define RUBY_RELEASE_CODE 20071114
|
#define RUBY_RELEASE_CODE 20071115
|
||||||
#define RUBY_PATCHLEVEL 5000
|
#define RUBY_PATCHLEVEL 5000
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#define RUBY_VERSION_TEENY 6
|
#define RUBY_VERSION_TEENY 6
|
||||||
#define RUBY_RELEASE_YEAR 2007
|
#define RUBY_RELEASE_YEAR 2007
|
||||||
#define RUBY_RELEASE_MONTH 11
|
#define RUBY_RELEASE_MONTH 11
|
||||||
#define RUBY_RELEASE_DAY 14
|
#define RUBY_RELEASE_DAY 15
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue