mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fs tftp: Fix short file transfers
@ 2012-06-24 11:30 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2012-06-24 11:30 UTC (permalink / raw)
  To: barebox

With files smaller than the tftp block size the whole transfer is done
in tftp_do_open already. In this case we are in STATE_DONE, but there
is no error. Set priv->err to 0 and check for it to be able to transfer
small files.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/tftp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/tftp.c b/fs/tftp.c
index e8a209e..6586270 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -336,6 +336,7 @@ static void tftp_handler(void *ctx, char *packet, unsigned len)
 
 		if (len < priv->blocksize) {
 			tftp_send(priv);
+			priv->err = 0;
 			priv->state = STATE_DONE;
 		}
 
@@ -423,7 +424,7 @@ static struct file_priv *tftp_do_open(struct device_d *dev,
 			goto out2;
 	}
 
-	if (priv->state == STATE_DONE) {
+	if (priv->state == STATE_DONE && priv->err) {
 		ret = priv->err;
 		goto out2;
 	}
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-06-24 11:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-24 11:30 [PATCH] fs tftp: Fix short file transfers Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox