[Libvir] Patch: Fix documentation and code of virGetDomain function

Daniel P. Berrange berrange at redhat.com
Wed Mar 7 16:48:03 UTC 2007


On Wed, Mar 07, 2007 at 04:29:16AM -0500, Daniel Veillard wrote:
> On Tue, Mar 06, 2007 at 10:06:32PM +0000, Daniel P. Berrange wrote:
> > On Thu, Mar 01, 2007 at 09:46:11AM +0000, Mark McLoughlin wrote:
> > > On Wed, 2007-02-28 at 16:24 +0000, Richard W.M. Jones wrote:
> > > >  virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
> > > >      virDomainPtr ret = NULL;
> > > >  
> > > > -    if ((!VIR_IS_CONNECT(conn)) || ((name == NULL) && (uuid == NULL)) ||
> > > > +    if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL) || 
> > > 
> > > 	Need the same fix in virGetNetwork()
> > 
> > Applied Rich's patch to CVS along with the corresponding fix to virGetNetwork
> 
>   Changing documented semantic because there is a bug (or rather TODO) doesn't
> sound right to me.

Well fixing the code to hash based on UUIDs was not so straightforward
so the easiest was to update the docs to match reality. All of the current
callers always provide a non-NULL name & UUID. When someone gets time we
can still make it hash based on UUID instead, but until its done I think its
better to have acccurate docs to avoid confusing people using it and then
wondering why they get a SEGV on a NULL dereference.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list