diff options
author | Alexey Gaziev <alex.gaziev@gmail.com> | 2012-04-29 01:10:58 +0400 |
---|---|---|
committer | Alexey Gaziev <alex.gaziev@gmail.com> | 2012-04-29 03:12:07 +0400 |
commit | 92572241e2966529360106aec086373d56904dbc (patch) | |
tree | db790f3e88a4e0e44edf5fb06c75a90993d03e97 /activesupport/lib/active_support/core_ext/file | |
parent | 1946d7b9229fabb52226f9ff82de72872c748d90 (diff) | |
download | rails-92572241e2966529360106aec086373d56904dbc.tar.gz rails-92572241e2966529360106aec086373d56904dbc.tar.bz2 rails-92572241e2966529360106aec086373d56904dbc.zip |
AS core_ext refactoring pt.2
Diffstat (limited to 'activesupport/lib/active_support/core_ext/file')
-rw-r--r-- | activesupport/lib/active_support/core_ext/file/atomic.rb | 10 |
1 files changed, 8 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 fc3277f4d2..99c9435275 100644 --- a/activesupport/lib/active_support/core_ext/file/atomic.rb +++ b/activesupport/lib/active_support/core_ext/file/atomic.rb @@ -26,8 +26,14 @@ class File old_stat = stat(file_name) rescue Errno::ENOENT # No old permissions, write a temp file to determine the defaults - check_name = join(dirname(file_name), ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}") - open(check_name, "w") { } + temp_file_name = [ + '.permissions_check', + Thread.current.object_id, + Process.pid, + rand(1000000) + ].join('.') + check_name = join(dirname(file_name), temp_file_name) + open(check_name, 'w') { } old_stat = stat(check_name) unlink(check_name) end |