diff --git a/libexec/tftpd/tftp-transfer.c b/libexec/tftpd/tftp-transfer.c index 052714fb5a2e..c2c9e0793354 100644 --- a/libexec/tftpd/tftp-transfer.c +++ b/libexec/tftpd/tftp-transfer.c @@ -279,6 +279,8 @@ tftp_receive(int peer, uint16_t *block, struct tftp_stats *ts, send_error(peer, ENOSPACE); goto abort; } + if (n_data != segsize) + write_close(); } send_ack: @@ -304,8 +306,6 @@ tftp_receive(int peer, uint16_t *block, struct tftp_stats *ts, gettimeofday(&(ts->tstop), NULL); } while (n_data == segsize); - write_close(); - /* Don't do late packet management for the client implementation */ if (acting_as_client) return;