From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ztvz7-0004yW-0P for qemu-devel@nongnu.org; Wed, 04 Nov 2015 06:12:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ztvz6-0007Io-70 for qemu-devel@nongnu.org; Wed, 04 Nov 2015 06:12:08 -0500 Date: Wed, 4 Nov 2015 12:12:00 +0100 From: Kevin Wolf Message-ID: <20151104111200.GC4026@noname.redhat.com> References: <1446506900-27733-1-git-send-email-jsnow@redhat.com> <5637F525.5060109@redhat.com> <5637F5AE.5020006@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5637F5AE.5020006@redhat.com> Subject: Re: [Qemu-devel] [PATCH] qemu-img: add check for zero-length job len List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: jcody@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org Am 03.11.2015 um 00:45 hat John Snow geschrieben: > >> diff --git a/qemu-img.c b/qemu-img.c > >> index 3025776..38b4888 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.00, 0); > > > > Also, note that this promotes to double rather than float; maybe you > > want to use 0.f instead of 0.00 to keep the ternary as a float? But it > > shouldn't make a difference in practice. > > Yes, oops -- but harmless. Thanks, fixed that up and applied to the block branch. Kevin