* lib/pstore.rb (PStore#transaction): get rid of opening in write mode
when read only transaction. [ruby-dev:23842] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7662d794fe
commit
73cf1d02ba
@ -1,3 +1,8 @@
|
||||
Thu Jul 1 18:31:31 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/pstore.rb (PStore#transaction): get rid of opening in write mode
|
||||
when read only transaction. [ruby-dev:23842]
|
||||
|
||||
Thu Jul 1 00:44:42 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* ext/openssl/ossl_cipher.c (ossl_cipher_encrypt, ossl_cipher_decrypt):
|
||||
|
@ -97,18 +97,15 @@ class PStore
|
||||
new_file = @filename + ".new"
|
||||
|
||||
content = nil
|
||||
file = File.open(@filename, File::RDWR | File::CREAT)
|
||||
unless read_only
|
||||
file = File.open(@filename, File::RDWR | File::CREAT)
|
||||
file.flock(File::LOCK_EX)
|
||||
commit_new(file) if FileTest.exist?(new_file)
|
||||
content = file.read()
|
||||
else
|
||||
file = File.open(@filename, File::RDONLY)
|
||||
file.flock(File::LOCK_SH)
|
||||
if FileTest.exist?(new_file)
|
||||
File.open(new_file) {|fp| content = fp.read()}
|
||||
else
|
||||
content = file.read()
|
||||
end
|
||||
content = (File.read(new_file) rescue file.read())
|
||||
end
|
||||
|
||||
if content != ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user