aboutsummaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-06-22 10:18:30 +0000
committerEric Andersen <andersen@codepoet.org>2004-06-22 10:18:30 +0000
commit4872ed9737c1349aec2f41b1b8a905a9158da5c1 (patch)
tree94b214366ce9fe141a9c2489f84ca91f9bbfcafa /networking/tftp.c
parent7f94a5caa251d3d539bbcf75eb97f11824c577ee (diff)
downloadbusybox-w32-4872ed9737c1349aec2f41b1b8a905a9158da5c1.tar.gz
busybox-w32-4872ed9737c1349aec2f41b1b8a905a9158da5c1.tar.bz2
busybox-w32-4872ed9737c1349aec2f41b1b8a905a9158da5c1.zip
Robin Farine writes:
Hi, Package: BusyBox Version: 1.0.0-pre10 When an incomplete read or write from/to a local file occurs (i.e. not an EOF condition), the tftp client prematurely exits. This problem can be reproduced by slowly piping data to the tftp client like this: (for v in 1 2 3; do echo $v; sleep 1; done) | \ tftp -p -l - -r output.txt <host> The output file on the TFTP server will contain "1". The attached patch provides a possible solution to this problem. I can reproduce this on ARM sa1110 and ARM xscale boards, both running Linux-2.6.4 & glibc-2.3.2. Thanks for the wonderful program! Robin
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index bfa9897b9..02ddb4ded 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -267,7 +267,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
267 block_nr++; 267 block_nr++;
268 268
269 if (cmd_put && (opcode == TFTP_DATA)) { 269 if (cmd_put && (opcode == TFTP_DATA)) {
270 len = read(localfd, cp, tftp_bufsize - 4); 270 len = bb_full_read(localfd, cp, tftp_bufsize - 4);
271 271
272 if (len < 0) { 272 if (len < 0) {
273 bb_perror_msg("read"); 273 bb_perror_msg("read");
@@ -444,7 +444,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
444 444
445 if (tmp == block_nr) { 445 if (tmp == block_nr) {
446 446
447 len = write(localfd, &buf[4], len - 4); 447 len = bb_full_write(localfd, &buf[4], len - 4);
448 448
449 if (len < 0) { 449 if (len < 0) {
450 bb_perror_msg("write"); 450 bb_perror_msg("write");