Permalink
Browse files

Make sure the permissions check file is closed before being unlinked.

[#1035 state:committed]
  • Loading branch information...
1 parent a17027d commit d28c724b4074605445d2834888ad280778f0af6a @NZKoz NZKoz committed Sep 14, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/file/atomic.rb
View
2 activesupport/lib/active_support/core_ext/file/atomic.rb
@@ -28,7 +28,7 @@ def atomic_write(file_name, temp_dir = Dir.tmpdir)
rescue Errno::ENOENT
# No old permissions, write a temp file to determine the defaults
check_name = ".permissions_check.#{Thread.current.object_id}.#{Process.pid}.#{rand(1000000)}"
- new(check_name, "w")
+ open(check_name, "w") { }
old_stat = stat(check_name)
unlink(check_name)
end

0 comments on commit d28c724

Please sign in to comment.