1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even

when an exception is raised at @tempfile.close. [ruby-dev:45113]

* lib/tempfile.rb (Tempfile#unlink): fix a typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2012-01-09 15:46:25 +00:00
parent 896844a0cc
commit c572ed2d25
2 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,10 @@
Tue Jan 10 00:41:28 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even
when exception is raised at @tempfile.close. [ruby-dev:45113]
* lib/tempfile.rb (Tempfile#unlink): fix a typo.
Tue Jan 10 00:32:17 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
* gc.c (run_finalizer): clear rb_thread_t::errinfo when ignore

View file

@ -162,9 +162,12 @@ class Tempfile < DelegateClass(File)
end
def _close # :nodoc:
@tmpfile.close if @tmpfile
@tmpfile = nil
@data[1] = nil if @data
begin
@tmpfile.close if @tmpfile
ensure
@tmpfile = nil
@data[1] = nil if @data
end
end
protected :_close
@ -231,7 +234,7 @@ class Tempfile < DelegateClass(File)
File.unlink(@tmpname)
end
# remove tmpname from remover
@data[0] = @data[2] = nil
@data[0] = @data[1] = nil
@tmpname = nil
rescue Errno::EACCES
# may not be able to unlink on Windows; just ignore