From 7167c88ead8614e356c53b100808efe2dc15380b Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Mon, 10 Jun 2019 16:36:13 -0700 Subject: tqftpserv: Don't close socket at EOF When during a read we close the socket as we send the last block the remote will be notified about the closure and consider the transfer incomplete. Leave the socket open until we receive a EOF error from the remote side. Signed-off-by: Bjorn Andersson --- tqftpserv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tqftpserv.c b/tqftpserv.c index 5c4cb47..dd9b270 100644 --- a/tqftpserv.c +++ b/tqftpserv.c @@ -423,9 +423,11 @@ static int handle_reader(struct tftp_client *client) break; } printf("[TQFTP] Sent block %d of %zd\n", block + 1, n); + if (n == 0) + break; } - return n == 0 ? 0 : 1; + return 1; } static int handle_writer(struct tftp_client *client) -- cgit v1.2.3