9
0
Fork 0

fs tftp: Fix short file transfers

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>
This commit is contained in:
Sascha Hauer 2012-06-24 13:00:25 +02:00
parent b62cf8f36d
commit ecf38bff9b
1 changed files with 2 additions and 1 deletions

View File

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