summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 15:49:13 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-27 15:49:13 +0000
commit9b612d382de382913d3eab12dac986fc5fc21864 (patch)
tree02415ac36a66f8bee02954d820dac33104775678
parent36276b6f40fe87aec2883a7641a249002a3bb7a9 (diff)
* 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
-rw-r--r--ChangeLog11
-rw-r--r--lib/cgi/core.rb4
-rw-r--r--test/lib/minitest/unit.rb2
-rw-r--r--test/openssl/test_config.rb2
-rw-r--r--test/ruby/test_io.rb8
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 <akr@fsij.org>
+
+ * 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 <akr@fsij.org>
* 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 <akr@fsij.org>
Tue May 27 23:50:07 2014 Tanaka Akira <akr@fsij.org>
- * 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 <nobu@ruby-lang.org>
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