[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]