summaryrefslogtreecommitdiff
path: root/lib/pstore.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-14 06:18:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-14 06:18:59 +0000
commita1c02ee495d945f943fedc3f11fcb323289dc756 (patch)
tree258fdf9c591ffa5bab8d8be49302198241eb4fa7 /lib/pstore.rb
parente60d5563210cccef2e9da17970ab3ea1906a8185 (diff)
* math.c (math_acos): check errno after operation. ditto for
asin, acosh, atanh, log, log10 and sqrt. * eval.c (rb_add_method): initialize should always be private. * parse.y (expr): add rescue modifier rule. * parse.y (command_call): return, break and next with argument is now part of this rule. * parse.y (yylex): "a" in "a /5" should be considered as a local variable. [experimental] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pstore.rb')
-rw-r--r--lib/pstore.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb
index dfec76e470..dd74f4fc2f 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -102,7 +102,7 @@ class PStore
file.flock(read_only ? File::LOCK_SH : File::LOCK_EX)
if read_only
@table = Marshal::load(file)
- elsif orig and (content = file.read) != nil
+ elsif orig and (content = file.read) != ""
@table = Marshal::load(content)
size = content.size
md5 = Digest::MD5.digest(content)
@@ -118,7 +118,7 @@ class PStore
@abort = true
raise
ensure
- if !read_only && !@abort
+ if !read_only and !@abort
file.rewind
content = Marshal::dump(@table)
if !md5 || size != content.size || md5 != Digest::MD5.digest(content)
@@ -133,6 +133,9 @@ class PStore
end
end
end
+ if @abort and !orig
+ File.unlink(@filename)
+ end
@abort = false
end
ensure