qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 13/14] commit: Use BlockBackend for I/O


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2 13/14] commit: Use BlockBackend for I/O
Date: Tue, 24 May 2016 22:04:32 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 05/24/2016 09:51 PM, Changlong Xie wrote:
> On 05/24/2016 09:47 PM, Kevin Wolf wrote:
>> +    s->base = blk_new();
> blk_new(errp);
>> +    blk_insert_bs(s->base, base);
>> +
>> +    s->top = blk_new();
> blk_new(errp);

Wrong. Even if it weren't for basing it on top of Kevin's branch which
removes the Error parameter, you can't safely pass errp to two functions
in a row (if both functions fail, the second will cause an assertion
error for trying to set an already-set error); the correct usage when
calling multiple functions that can set errors requires the use of a
local Error *err = NULL; up front, then error_propagate(errp, err) after
each place where it can be set.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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