From: Marc Hoersken Date: Fri, 20 Nov 2020 07:13:47 +0000 (+0100) Subject: tests/server/tftpd.c: close upload file right after transfer X-Git-Tag: curl-7_74_0~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c353207;p=thirdparty%2Fcurl.git tests/server/tftpd.c: close upload file right after transfer Make sure uploaded file is no longer locked after the transfer while waiting for the final ACK to be handled. Assisted-by: Daniel Stenberg Bug: #6058 Closes #6209 --- diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c index 4215bfe4aa..fdd6e061e7 100644 --- a/tests/server/tftpd.c +++ b/tests/server/tftpd.c @@ -821,11 +821,6 @@ int main(int argc, char **argv) sclose(peer); peer = CURL_SOCKET_BAD; - if(test.ofile > 0) { - close(test.ofile); - test.ofile = 0; - } - if(got_exit_signal) break; @@ -1304,6 +1299,10 @@ send_ack: } } while(size == SEGSIZE); write_behind(test, pf->f_convert); + if(test->ofile > 0) { + close(test->ofile); + test->ofile = 0; + } rap->th_opcode = htons((unsigned short)opcode_ACK); /* send the "final" ack */