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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Jan 8 15:15:37 UTC 2008


Dan Smith wrote:
> 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++;

Ah good point.  Yep, I didn't notice this.
> 
> 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.

I'd vote for not capturing the return from the get_emu_device() and 
get_graphics_device() in get_dominfo().

Trying to handle the return in a meaningful way would probably not be 
obvious and would need a comment..

-- 
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com




More information about the Libvirt-cim mailing list