aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-27 10:10:54 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-27 10:10:54 +0000
commit6cdc55f4a3441e5b9b0839f3c3e0ae885a4bee90 (patch)
tree55b12c261911cecb2e64a31ff130660585105c80 /lib
parentb8d544832b8cbb041b87fc45c2c5614143af0fb5 (diff)
downloadruby-6cdc55f4a3441e5b9b0839f3c3e0ae885a4bee90.tar.gz
* lib/net/ftp.rb (makeport): close the TCPServer
when sending the port fails. * test/net/ftp/test_ftp.rb: test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ftp.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 83ceaff405..3eec86ae99 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -377,15 +377,9 @@ module Net
end
private :sendport
- # Constructs a TCPServer socket, and sends it the PORT command
- #
- # Returns the constructed TCPServer socket
+ # Constructs a TCPServer socket
def makeport # :nodoc:
- sock = TCPServer.open(@sock.addr[3], 0)
- port = sock.addr[1]
- host = sock.addr[3]
- sendport(host, port)
- return sock
+ TCPServer.open(@sock.addr[3], 0)
end
private :makeport
@@ -421,6 +415,7 @@ module Net
else
sock = makeport
begin
+ sendport(sock.addr[3], sock.addr[1])
if @resume and rest_offset
resp = sendcmd("REST " + rest_offset.to_s)
if resp[0] != ?3