qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/7] qga/vss-win32: Document the DLL requires no


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 4/7] qga/vss-win32: Document the DLL requires non-null errp
Date: Tue, 21 Jul 2015 09:56:33 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 06/22/2015 01:26 PM, Markus Armbruster wrote:
> requester.cpp uses this pattern to receive an error and pass it on to
> the caller (err_is_set() macro peeled off for clarity):
> 
>     ... code that may set errset->errp ...
>     if (errset->errp && *errset->errp) {
>         ... handle error ...
>     }
> 
> This breaks when errset->errp is null.  As far as I can tell, it
> currently isn't, so this is merely fragile, not actually broken.
> 
> The robust way to do this is to receive the error in a local variable,
> then propagate it up, like this:
> 
>     Error *err = NULL;
> 
>     ... code that may set err ...
>     if (err)
>         ... handle error ...
>         error_propagate(errset->errp, err);
>     }
> 
> See also commit 5e54769, 0f230bf, a903f40.
> 
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
>  qga/vss-win32.c             | 1 +
>  qga/vss-win32/requester.cpp | 3 ++-
>  qga/vss-win32/requester.h   | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Eric Blake <address@hidden>

-- 
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]