From 9b612d382de382913d3eab12dac986fc5fc21864 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 27 May 2014 15:49:13 +0000 Subject: * test/lib/minitest/unit.rb: Use Tempfile#close! instead of Tempfile#unlink to close file descriptors. * test/openssl/test_config.rb: Ditto. * test/ruby/test_io.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 11 ++++++++++- lib/cgi/core.rb | 4 ++-- test/lib/minitest/unit.rb | 2 +- test/openssl/test_config.rb | 2 +- test/ruby/test_io.rb | 8 ++++---- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3610cee7d4..dc7b0c715b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Wed May 28 00:38:09 2014 Tanaka Akira + + * test/lib/minitest/unit.rb: Use Tempfile#close! instead of + Tempfile#unlink to close file descriptors. + + * test/openssl/test_config.rb: Ditto. + + * test/ruby/test_io.rb: Ditto. + Wed May 28 00:06:18 2014 Tanaka Akira * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an @@ -5,7 +14,7 @@ Wed May 28 00:06:18 2014 Tanaka Akira Tue May 27 23:50:07 2014 Tanaka Akira - * lib/cgi/core.rb: Use Tempfile#close(true) instead of Tempfile#unlink + * lib/cgi/core.rb: Use Tempfile#close! instead of Tempfile#unlink to close file descriptors. Tue May 27 23:06:46 2014 Nobuyoshi Nakada diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 76b3a24b91..b80e036a86 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -550,7 +550,7 @@ class CGI name = $1 || $2 || '' if body.original_filename.empty? value=body.read.dup.force_encoding(@accept_charset) - body.close(true) if defined?(Tempfile) && body.kind_of?(Tempfile) + body.close! if defined?(Tempfile) && body.kind_of?(Tempfile) (params[name] ||= []) << value unless value.valid_encoding? if @accept_charset_error_block @@ -578,7 +578,7 @@ class CGI if tempfiles tempfiles.each {|t| if t.path - t.close(true) + t.close! end } end diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb index 5847da7d8c..bc6bf48ebf 100644 --- a/test/lib/minitest/unit.rb +++ b/test/lib/minitest/unit.rb @@ -1063,7 +1063,7 @@ module MiniTest list.each {|str| puts "Leaked tempfile: #{name}: #{str}" } - tempfile_retained.each {|t| t.unlink } + tempfile_retained.each {|t| t.close! } end live2 end diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb index 1cd3cb6391..4ad90c43f5 100644 --- a/test/openssl/test_config.rb +++ b/test/openssl/test_config.rb @@ -17,7 +17,7 @@ __EOD__ end def teardown - @tmpfile.unlink + @tmpfile.close! end def test_constants diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 170b08d310..b104086d43 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1924,7 +1924,7 @@ class TestIO < Test::Unit::TestCase assert_raise(Errno::EBADF, feature2250) {t.close} end ensure - t.unlink + t.close! end def test_autoclose_false_closed_by_finalizer @@ -1940,7 +1940,7 @@ class TestIO < Test::Unit::TestCase assert_nothing_raised(Errno::EBADF, feature2250) {t.close} end ensure - t.unlink + t.close! end def test_open_redirect @@ -2366,7 +2366,7 @@ End } ensure GC.start - t.unlink + t.close! end def test_flush_in_finalizer2 @@ -2382,7 +2382,7 @@ End assert_nothing_raised(TypeError, bug3910) do GC.start end - t.unlink + t.close! } end -- cgit v1.2.3