mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Ticket #2448: division by zero in file copy progress dialog.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru> Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
31d440ca6e
commit
4abfaf8172
@ -528,14 +528,15 @@ copy_file_file_display_progress (FileOpTotalContext * tctx, FileOpContext * ctx,
|
||||
|
||||
if (total_secs < 1)
|
||||
total_secs = 1;
|
||||
|
||||
tctx->bps = tctx->copyed_bytes / total_secs;
|
||||
tctx->eta_secs = remain_bytes / tctx->bps;
|
||||
tctx->eta_secs = (tctx->bps != 0) ? remain_bytes / tctx->bps : 0;
|
||||
}
|
||||
#else
|
||||
/* broken on lot of little files */
|
||||
tctx->bps_count++;
|
||||
tctx->bps = (tctx->bps * (tctx->bps_count - 1) + ctx->bps) / tctx->bps_count;
|
||||
tctx->eta_secs = remain_bytes / tctx->bps;
|
||||
tctx->eta_secs = (tctx->bps != 0) ? remain_bytes / tctx->bps : 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user