From ad5757276d48761ff9e071991d3957f75ce2d4b4 Mon Sep 17 00:00:00 2001 From: nagachika Date: Tue, 24 Dec 2013 15:37:51 +0000 Subject: merge revision(s) 44184: [Backport #9247] * ext/socket/lib/socket.rb: Don't test $! in "ensure" clause because it may be set before the body. Reported by ko1 and mrkn. [ruby-core:59088] [Bug #9247] * lib/cgi/core.rb: Ditto. * lib/drb/ssl.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/cgi/core.rb | 5 +++-- lib/drb/ssl.rb | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index 27137a2032..1ab8e8c7d9 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -574,14 +574,15 @@ class CGI raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/ params.default = [] params - ensure - if $! && tempfiles + rescue Exception + if tempfiles tempfiles.each {|t| if t.path t.unlink end } end + raise end # read_multipart private :read_multipart def create_body(is_large) #:nodoc: diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb index 8651702797..e7d9569eb6 100644 --- a/lib/drb/ssl.rb +++ b/lib/drb/ssl.rb @@ -328,8 +328,9 @@ module DRb end begin ssl = @config.accept(soc) - ensure - soc.close if $! + rescue Exception + soc.close + raise end self.class.new(uri, ssl, @config, true) rescue OpenSSL::SSL::SSLError -- cgit v1.2.3