1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

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
This commit is contained in:
Marc Hoersken 2020-11-24 20:49:09 +01:00
parent c7b02c5d68
commit 227daceabe
No known key found for this signature in database
GPG Key ID: 61E03CBED7BC859E

View File

@ -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;
}