Permalink
Browse files

File should be open in read/write mode. When doing lock on a file.

  • Loading branch information...
1 parent 2bd5e02 commit c6c46e1d1bad1c044693d5645cbaf40074ac8ad4 @arunagw arunagw committed with tenderlove Apr 18, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/cache/file_store.rb
@@ -120,7 +120,7 @@ def delete_entry(key, options)
# 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

0 comments on commit c6c46e1

Please sign in to comment.