diff options
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/file/atomic.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/file/atomic.rb b/activesupport/lib/active_support/core_ext/file/atomic.rb index 81beb4e85d..38ea7f8fb3 100644 --- a/activesupport/lib/active_support/core_ext/file/atomic.rb +++ b/activesupport/lib/active_support/core_ext/file/atomic.rb @@ -23,10 +23,10 @@ class File yield temp_file temp_file.close - begin + if File.exists?(file_name) # Get original file permissions old_stat = stat(file_name) - rescue Errno::ENOENT + else # If not possible, probe which are the default permissions in the # destination directory. old_stat = probe_stat_in(dirname(file_name)) |