diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2019-06-10 16:36:13 -0700 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2019-06-10 16:36:13 -0700 |
commit | 7167c88ead8614e356c53b100808efe2dc15380b (patch) | |
tree | 479b95a5e8edfddf6712e2a8bf108b42fc202952 | |
parent | 2ae2758cbaf0a2c8c79f06cb6c5363b3d2c50ff9 (diff) |
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 <bjorn.andersson@linaro.org>
-rw-r--r-- | tqftpserv.c | 4 |
1 files changed, 3 insertions, 1 deletions
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) |