• M
    qga/vss-win32: Document the DLL requires non-null errp · 08e64640
    Markus Armbruster 提交于
    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 5e54769c, 0f230bf7, a903f40c.
    Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
    Reviewed-by: NEric Blake <eblake@redhat.com>
    08e64640
vss-win32.c 4.4 KB