diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-30 12:04:22 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-01-30 12:04:22 +0000 |
commit | 75c84da28c5e9169a4d48efd1a542d8278b1d436 (patch) | |
tree | aba4151f60973be87e2af5bf752b2f670ad9b015 /lib | |
parent | 1bd12d78c79c1194363f7755acab0a31109b935a (diff) |
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_1_9_3@44767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cgi/core.rb | 11 | ||||
-rw-r--r-- | lib/drb/ssl.rb | 5 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb index e961b16474..d7ec8981d7 100644 --- a/lib/cgi/core.rb +++ b/lib/cgi/core.rb @@ -478,10 +478,12 @@ class CGI bufsize = 10 * 1024 max_count = MAX_MULTIPART_COUNT n = 0 + tempfiles = [] while true (n += 1) < max_count or raise StandardError.new("too many parameters.") ## create body (StringIO or Tempfile) body = create_body(bufsize < content_length) + tempfiles << body if defined?(Tempfile) && body.kind_of?(Tempfile) class << body if method_defined?(:path) alias local_path path @@ -562,6 +564,15 @@ class CGI raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/ params.default = [] params + 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 2b6a2376ef..a680594d80 100644 --- a/lib/drb/ssl.rb +++ b/lib/drb/ssl.rb @@ -179,8 +179,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 |