[Libvirt-cim] [PATCH] Fix get_graphics_device() - returns error if graphics tag is missing

Dan Smith danms at us.ibm.com
Tue Jan 8 14:56:18 UTC 2008


KR> -        return ret;
KR> +        return 1;

This will cause the do_parse() function to keep an empty (and
uninitialized) device struct on the list, because of this:

> if (do_real_parse(dev_nodes[devidx], &list[lstidx]))
>         lstidx++;

Which is bad.  I think we need to keep the conditional return value
From those individual functions.  I think the problem lies just with
this bit in get_dominfo():

> ret = get_emu_device(dom, &(*dominfo)->dev_emu);
> ret = get_graphics_device(dom, &(*dominfo)->dev_graphics);

Which was me thinking that I'd capture the return value and maybe
check it later, but ignore for now.  The problem is that we return ret
a few lines down, which makes the function fail if one of the two
above calls fail.

So, I think the solution here for now is to either do something
meaningful with ret (not sure what that would be), or just remove
'ret =' from each call and truly ignore the status of those.

Also,

KR> -        return ret;
KR> +        return 1;

These functions now return a bool instead of an int.  Maybe you need
to update your tree?

Thanks!

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080108/0d6bbd90/attachment.sig>


More information about the Libvirt-cim mailing list