summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-05-21 15:55:14 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2015-05-21 16:28:42 +0200
commit856c9aead21ea3777bc0c84c9d78fd659be8b7a9 (patch)
tree8a8f7cb7f154af166e92663ee4387e015eff16e3 /net
parent06ee8db6422e02337242e43b8573359443db59ea (diff)
tftp.c: fix CONFIG_TFTP_TSIZE for small files
CONFIG_TFTP_TSIZE should limit a tftp downloads progress to 50 '#' chars. Make this work also for small files. If the file size is small, i.e. smaller than 2 tftp block sizes the number of '#' can get much larger. i.e. with a 1 byte file 65000 characters are printed, with a 512 byte file around 500. When using CONFIG TFTP BLOCKSIZE together with CONFIG_IP_DEFRAG the issue is more notable. Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'net')
-rw-r--r--net/tftp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 0a2c53302c..fd58660d3b 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -239,6 +239,8 @@ static void show_block_marker(void)
#ifdef CONFIG_TFTP_TSIZE
if (TftpTsize) {
ulong pos = TftpBlock * TftpBlkSize + TftpBlockWrapOffset;
+ if(pos > TftpTsize)
+ pos = TftpTsize;
while (TftpNumchars < pos * 50 / TftpTsize) {
putc('#');