aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorArun Agrawal <arun@fromjaipur.com>2011-04-18 17:06:07 +0530
committerAaron Patterson <aaron.patterson@gmail.com>2011-04-18 09:08:53 -0700
commit92537b8c273ea57eb7e1d686071f1876a5e9abe4 (patch)
treef46643af8df972454c5f01edcc2736b01cbc7f6e /activesupport
parent3b0f917b1dfabce6a6b338e4a7cb02995c055596 (diff)
downloadrails-92537b8c273ea57eb7e1d686071f1876a5e9abe4.tar.gz
rails-92537b8c273ea57eb7e1d686071f1876a5e9abe4.tar.bz2
rails-92537b8c273ea57eb7e1d686071f1876a5e9abe4.zip
File should be open in read/write mode. When doing lock on a file.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/cache/file_store.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/cache/file_store.rb b/activesupport/lib/active_support/cache/file_store.rb
index 9936b33e22..a1376ae52a 100644
--- a/activesupport/lib/active_support/cache/file_store.rb
+++ b/activesupport/lib/active_support/cache/file_store.rb
@@ -121,7 +121,7 @@ module ActiveSupport
# Lock a file for a block so only one process can modify it at a time.
def lock_file(file_name, &block) # :nodoc:
if File.exist?(file_name)
- File.open(file_name, 'r') do |f|
+ File.open(file_name, 'r+') do |f|
begin
f.flock File::LOCK_EX
yield