From 5e81e8675a020ecd493620a4ff38db8fcf4b972a Mon Sep 17 00:00:00 2001 From: Shugo Maeda Date: Tue, 19 May 2020 17:46:21 +0900 Subject: [PATCH] Ignore exceptions when closing data connections [Bug #16780] Patch by koshigoe (Masataka SUZUKI). Thanks! --- lib/net/ftp.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 307b40e6dd..eedb88c49f 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -634,9 +634,9 @@ module Net while data = conn.read(blocksize) yield(data) end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end @@ -659,9 +659,9 @@ module Net while line = conn.gets yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?) end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end @@ -688,9 +688,9 @@ module Net conn.write(buf) yield(buf) if block_given? end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end @@ -724,9 +724,9 @@ module Net conn.write(buf) yield(buf) if block_given? end - conn.shutdown(Socket::SHUT_WR) + conn.shutdown(Socket::SHUT_WR) rescue nil conn.read_timeout = 1 - conn.read + conn.read rescue nil ensure conn.close if conn end