uberftp/disconnected_server.patch

31 lines
782 B
Diff

From 4c1cb01d712923c63f23a975eec13170aa57d992 Mon Sep 17 00:00:00 2001
From: Brian Bockelman <bbockelman@morgridge.org>
Date: Thu, 26 Dec 2019 13:34:02 -0600
Subject: [PATCH] Prevent uberftp from hanging when the command socket closes
---
ftp.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ftp.c b/ftp.c
index 3c65d18..dfd4739 100644
--- a/ftp.c
+++ b/ftp.c
@@ -2742,6 +2742,14 @@ _f_get_resp(fh_t * fh, int * code, char ** resp)
FREE(cptr);
}
+ /* There was no command sent and the server side closed the socket. */
+ if (!nl && fh->cc.eof)
+ {
+ ec = ec_create(EC_GSI_SUCCESS,
+ EC_GSI_SUCCESS,
+ "Server unexpectedly closed the socket.");
+ }
+
if (!ec && *code == 421)
{
ec = ec_create(EC_GSI_SUCCESS,
--
2.21.0