e$B$H$_$?$G$9!#e(B
1.8.6 e$B$Ge(B CGI::Session::FileStore
e$B$N%G!<%?$,2u$l$k$3$H$,$"$j$^$9!#e(B
- LOCK_EX e$B$r3MF@$G$-$F$J$$$N$K%U%!%$%k$NFbMF$r>C$7$F$$$k!#e(B
412: f = File.open(@path, File::CREAT|File::TRUNC|File::RDWR, 0600)
413: f.flock File::LOCK_EX
- finalizer
e$B$+$i8F$P$l$k;~!"%U%!%$%k$NFbMF$,CfESH>C<$K$J$k$3$H$,$"$k!#e(B
e$B$3$C$A$N860x$ONI$/J,$+$j$^$;$s$,!"e(B@hash
e$B$NFbMF$r%U%!%$%k$K=PNO$7$F$$$ke(B
e$B;~$K2?$+$,5/$-$FESCf$^$G$K$J$C$F$7$^$&$h$&$G$9!#e(BCGI
e$B$,=*N;$7$J$$$&$A$Ke(B
e$B%V%i%&%6$,JL$N%j%s%/$r2!$7$?Ey$G!"e(BCGI e$B$,e(B SIGPIPE
e$B$K$J$C$?>l9g$KH/@8$9$ke(B
e$B$_$?$$$G$9!#e(B
e$B$H$$$&$3$H$G!"<!$N$h$&$K$7$F$_$?$i$&$^$/F0$$$F$$$k$h$&$G$9!#e(B
ā session.rb.orig 2007-02-13 08:01:19.000000000 +0900
+++ session.rb 2007-11-15 07:49:17.000000000 +0900
@@ -391,8 +391,9 @@
unless @hash
@hash = {}
begin
-
lockf = File.open(@path+".lock", "r")
-
lockf.flock File::LOCK_SH f = File.open(@path, 'r')
-
f.flock File::LOCK_SH for line in f line.chomp! k, v = line.split('=',2)
@@ -400,6 +401,7 @@
end
ensure
f.close unless f.nil?
-
endlockf.close if lockf end
@hash
@@ -409,13 +411,17 @@
def update
return unless @hash
begin
- f = File.open(@path, File::CREAT|File::TRUNC|File::RDWR, 0600)
- f.flock File::LOCK_EX
-
lockf = File.open(@path+".lock", File::CREAT|File::RDWR,
- lockf.flock File::LOCK_EX
-
f = File.open(@path+".new",
File::CREAT|File::TRUNC|File::WRONLY, 0600)
for k,v in @hash
f.printf ā%s=%s\nā, CGI::escape(k), CGI::escape(String(v))
end
-
f.close
-
File.rename @path+".new", @path ensure
-
f.close unless f.nil?
-
f.close if f and !f.closed?
-
lockf.close if lockf end end
@@ -426,6 +432,8 @@
# Close and delete the session's FileStore file.
def delete
-
File::unlink @path+".lock" rescue nil
-
File::unlink @path+".new" rescue nil File::unlink @path rescue Errno::ENOENT end