qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-img: add check for zero-lengt


From: Kevin Wolf
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH] qemu-img: add check for zero-length job len
Date: Wed, 4 Nov 2015 12:12:00 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]