From 7ab04edc3a9b134120b50d44aba8a4f6d5f91b8e Mon Sep 17 00:00:00 2001 From: Tomasz Torcz Date: Tue, 26 May 2015 14:37:42 +0200 Subject: [PATCH] [monojob] only display percentage when bigger than 0% This change will continue to show dots as progress until percentage crosses 1%. This is needed to work around problem with TFTP server on my old, unsupported Cisco switch. It provides nonsensical values for size, which causes percentage progress to be stuck at 0% during whole transfer. After the change dots are shown during whole transfer, providing at least some progress indicator. --- src/core/monojob.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/monojob.c b/src/core/monojob.c index 817f21b..9314105 100644 --- a/src/core/monojob.c +++ b/src/core/monojob.c @@ -126,7 +126,7 @@ int monojob_wait ( const char *string, unsigned long timeout ) { /* Normalise progress figures to avoid overflow */ scaled_completed = ( progress.completed / 128 ); scaled_total = ( progress.total / 128 ); - if ( scaled_total ) { + if ( scaled_total && scaled_completed ) { percentage = ( ( 100 * scaled_completed ) / scaled_total ); printf ( "%3d%%", percentage ); -- 2.1.0