summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2020-11-24 20:49:09 +0100
committerMarc Hoersken <info@marc-hoersken.de>2020-11-28 19:19:18 +0100
commit227daceabe7a8acd411cb8220d1b67d0d920bfc6 (patch)
tree2c8aae8ddd97b964373f727fe1a6b9e1ee1424a0
parentc7b02c5d680021f21aebdf41cb336a742fdad664 (diff)
downloadcurl-227daceabe7a8acd411cb8220d1b67d0d920bfc6.tar.gz
tests/server/tftpd.c: close upload file in case of abort
Commit c353207 removed the closing right after do_tftp which covered the case of abort. This handles that case. Reviewed-by: Jay Satiro Reviewed-by: Daniel Stenberg Follow up to #6209 Closes #6234
-rw-r--r--tests/server/tftpd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index fdd6e061e..92d584918 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -1299,6 +1299,7 @@ send_ack:
}
} while(size == SEGSIZE);
write_behind(test, pf->f_convert);
+ /* close the output file as early as possible after upload completion */
if(test->ofile > 0) {
close(test->ofile);
test->ofile = 0;
@@ -1325,6 +1326,11 @@ send_ack:
(void) swrite(peer, &ackbuf.storage[0], 4); /* resend final ack */
}
abort:
+ /* make sure the output file is closed in case of abort */
+ if(test->ofile > 0) {
+ close(test->ofile);
+ test->ofile = 0;
+ }
return;
}