aboutsummaryrefslogtreecommitdiffstats
path: root/lib/webrick
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:05:41 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-21 23:05:41 +0000
commit24a7251eb04fc7b90e325c082a521f5b86020c3f (patch)
tree015ae2e6909fd287ac1b3b18e0675196e181fb0d /lib/webrick
parentd2abd1f5031e4322795672bd6374b0aeb167e576 (diff)
downloadruby-24a7251eb04fc7b90e325c082a521f5b86020c3f.tar.gz
lib/*: remove closed checks
Follow r56795. Since Ruby 2.2, calling #close on a closed socket no longer raises exceptions. * lib/cgi/session.rb (update): remove closed? check * lib/net/http.rb (finish, transport_request): ditto * lib/net/imap.rb (disconnect): ditto * lib/net/pop.rb (do_start, do_finish): ditto * lib/net/smtp.rb (do_start, do_finish): ditto * lib/open3.rb (popen_run, pipeline_run): ditto * lib/pstore.rb (transaction): ditto * lib/shell/process-controller.rb (sfork): * lib/tempfile (_close, call, Tempfile.create): ditto * lib/webrick/httpauth/htdigest.rb (flush): ditto * lib/webrick/httpauth/htpasswd.rb (flush): ditto * lib/webrick/server.rb (start_thread, cleanup_shutdown_pipe): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick')
-rw-r--r--lib/webrick/httpauth/htdigest.rb2
-rw-r--r--lib/webrick/httpauth/htpasswd.rb2
-rw-r--r--lib/webrick/server.rb10
3 files changed, 6 insertions, 8 deletions
diff --git a/lib/webrick/httpauth/htdigest.rb b/lib/webrick/httpauth/htdigest.rb
index 1ef4fdb4aa..1b42c02dfa 100644
--- a/lib/webrick/httpauth/htdigest.rb
+++ b/lib/webrick/httpauth/htdigest.rb
@@ -79,7 +79,7 @@ module WEBrick
File::rename(tmp.path, output)
renamed = true
ensure
- tmp.close if !tmp.closed?
+ tmp.close
File.unlink(tmp.path) if !renamed
end
end
diff --git a/lib/webrick/httpauth/htpasswd.rb b/lib/webrick/httpauth/htpasswd.rb
index f43fc2c548..8c7b09463b 100644
--- a/lib/webrick/httpauth/htpasswd.rb
+++ b/lib/webrick/httpauth/htpasswd.rb
@@ -84,7 +84,7 @@ module WEBrick
File::rename(tmp.path, output)
renamed = true
ensure
- tmp.close if !tmp.closed?
+ tmp.close
File.unlink(tmp.path) if !renamed
end
end
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index 45bd9706d3..0a8e722b44 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -309,7 +309,7 @@ module WEBrick
else
@logger.debug "close: <address unknown>"
end
- sock.close unless sock.closed?
+ sock.close
end
}
end
@@ -334,11 +334,9 @@ module WEBrick
@shutdown_pipe = nil
return if !shutdown_pipe
shutdown_pipe.each {|io|
- if !io.closed?
- begin
- io.close
- rescue IOError # another thread closed io.
- end
+ begin
+ io.close
+ rescue IOError # another thread closed io.
end
}
end