[BusyBox-cvs] CVS update of busybox/networking (tftp.c)
Erik Andersen
andersen at codepoet.org
Tue Jun 22 10:18:31 UTC 2004
Date: Tuesday, June 22, 2004 @ 04:18:31
Author: andersen
Path: /var/cvs/busybox/networking
Modified: tftp.c (1.27 -> 1.28)
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
Index: busybox/networking/tftp.c
diff -u busybox/networking/tftp.c:1.27 busybox/networking/tftp.c:1.28
--- busybox/networking/tftp.c:1.27 Sat Mar 27 03:02:43 2004
+++ busybox/networking/tftp.c Tue Jun 22 04:18:30 2004
@@ -267,7 +267,7 @@
block_nr++;
if (cmd_put && (opcode == TFTP_DATA)) {
- len = read(localfd, cp, tftp_bufsize - 4);
+ len = bb_full_read(localfd, cp, tftp_bufsize - 4);
if (len < 0) {
bb_perror_msg("read");
@@ -444,7 +444,7 @@
if (tmp == block_nr) {
- len = write(localfd, &buf[4], len - 4);
+ len = bb_full_write(localfd, &buf[4], len - 4);
if (len < 0) {
bb_perror_msg("write");
More information about the busybox-cvs
mailing list