From: John Snow <js...@redhat.com> The mirror job doesn't update its total length until it has already started running, so we should translate a zero-length job-len as meaning 0%.
Otherwise, we may get divide-by-zero faults. Signed-off-by: John Snow <js...@redhat.com> Reviewed-by: Jeff Cody <jc...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> Signed-off-by: Kevin Wolf <kw...@redhat.com> --- qemu-img.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qemu-img.c b/qemu-img.c index 3025776..9831db7 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -656,7 +656,8 @@ static void run_block_job(BlockJob *job, Error **errp) do { aio_poll(aio_context, true); - qemu_progress_print((float)job->offset / job->len * 100.f, 0); + qemu_progress_print(job->len ? + ((float)job->offset / job->len * 100.f) : 0.0f, 0); } while (!job->ready); block_job_complete_sync(job, errp); -- 1.8.3.1