From 856c9aead21ea3777bc0c84c9d78fd659be8b7a9 Mon Sep 17 00:00:00 2001 From: Max Krummenacher Date: Thu, 21 May 2015 15:55:14 +0200 Subject: 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 --- net/tftp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'net') 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('#'); -- cgit v1.2.3