1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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:
nobu 2004-07-01 09:31:37 +00:00
parent 7662d794fe
commit 73cf1d02ba
2 changed files with 10 additions and 8 deletions

View file

@ -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):
@ -24,7 +29,7 @@ Wed Jun 30 19:48:09 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_cipher.c (ossl_cipher_alloc, ossl_cipher_initialize,
ossl_cipher_copy, ossl_cipher_reset, ossl_cipher_encrypt,
ossl_cipher_decrypt, ossl_cipher_final, ossl_cipher_set_key,
ossl_cipher_set_iv): replace all EVP_CipherInit and
ossl_cipher_set_iv): replace all EVP_CipherInit and
EVP_CipherFinal into EVP_CipherInit_ex and EVP_CipherFinal_ex.
and EVP_CIPHER_CTX_init should only be called once.
@ -33,7 +38,7 @@ Wed Jun 30 19:48:09 2004 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_cipher.c (Init_ossl_cipher): Cipher#<< is deprecated.
* ext/openssl/ossl_digest.c: replace all EVP_DigestInit and
* ext/openssl/ossl_digest.c: replace all EVP_DigestInit and
EVP_DigestFinal into EVP_DigestInit_ex and EVP_DigestFinal_ex.
and EVP_MD_CTX_init should only be called once.

View file

@ -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 != ""