aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2018-07-21 19:48:31 +0000
committerAlan Somers <asomers@FreeBSD.org>2018-07-21 19:48:31 +0000
commit7378015b694df3fbbc8cf51fe5ed352701f20e01 (patch)
tree67ee1275bc4163c81b2e5733d2aed5d86f44257f /libexec
parent85e089fe360636dc6a757a03259a3e4e825dccdb (diff)
downloadsrc-7378015b694df3fbbc8cf51fe5ed352701f20e01.tar.gz
src-7378015b694df3fbbc8cf51fe5ed352701f20e01.zip
tftpd(8): when completing an WRQ, flush the file before acknowleding receipt
tftpd(8) should flush a newly written file to disk before ACKing the final DATA packet. Otherwise there is a narrow race window when a subsequent read may not see the file. This is somewhat related to r330710, but the race window is much smaller. Hopefully this will fix the intermittent tests in Jenkins. Reported by: Jenkins MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=336587
Diffstat (limited to 'libexec')
-rw-r--r--libexec/tftpd/tftp-transfer.c4
1 files changed, 2 insertions, 2 deletions
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 @@ send_ack:
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;