[libvirt] [PATCH] Improve error reporting when parsing dhcp info for virtual networks
Eric Blake
eblake at redhat.com
Wed Jan 5 16:26:12 UTC 2011
On 01/04/2011 11:14 PM, Laine Stump wrote:
> This is partially in response to
>
> https://bugzilla.redhat.com/show_bug.cgi?id=653300
>
> The crash in that report was coincidentally fixed when we switched
> from using inet_pton() to using virSocketParseAddr(), but the absence
> of an ip address in a dhcp static host definition was still silently
> ignored (and that entry discarded from the saved XML). This patch
> turns that into a logged failure; likewise if the entry has neither a
> mac address nor a name attribute (the entry is useless without at
> least one of those, plus an ip address).
> /*
> * You need at least one MAC address or one host name
> */
> if ((mac == NULL) && (name == NULL)) {
> + virNetworkReportError(VIR_ERR_XML_ERROR,
> + _("Static host definition in network '%s' must have mac or name attribute"),
> + networkName);
> VIR_FREE(mac);
> VIR_FREE(name);
These two frees are pointless, given that you can only get here if both
variables are NULL. (might have been my fault in a previous patch, but
we should clean it up now while touching it again).
ACK with that nit fixed.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110105/f2185afd/attachment-0001.sig>
More information about the libvir-list
mailing list