[libvirt] [PATCH] Blank out the 'listenAddr' parameter if empty string

Eric Blake eblake at redhat.com
Wed May 18 17:14:17 UTC 2011


On 05/18/2011 11:08 AM, Daniel P. Berrange wrote:
> Some bogus apps are generating a VNC/SPICE/RFB listen attribute
> with no content. This then causes a failure with the graphics
> migration cookie parsing. Blank out the 'listenAddr' parameter
> after parsing domain XML if it is the empty string, so the host
> default takes over
> 
> * src/qemu/qemu_migration.c: Blank out listenAddr parameter
>   if empty
> ---
>  src/conf/domain_conf.c |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)

ACK to the principle of this patch.

> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 03f4dc9..15fe9f0 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -3906,6 +3906,10 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
>          def->data.vnc.socket = virXMLPropString(node, "socket");
>          def->data.vnc.keymap = virXMLPropString(node, "keymap");
>  
> +        if (def->data.vnc.listenAddr &&
> +            STREQ(def->data.vnc.listenAddr, ""))

STREQ() is pretty heavyweight to check for an empty string; it would be
simpler to do:

if (def->data.vnc.listenAddr && !*def->data.vnc.listenAddr)
    VIR_FREE(def->data.vnc.listenAddr);

That's a micro-optimization, though, so up to you which version you push.

-- 
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/20110518/824f6140/attachment-0001.sig>


More information about the libvir-list mailing list