[libvirt] [PATCH] conf: Fix virtType check

Peter Krempa pkrempa at redhat.com
Tue Sep 29 09:34:05 UTC 2015


On Fri, Sep 25, 2015 at 17:39:57 -0400, John Ferlan wrote:
> Commit id '7383b8cc' changed virDomainDef 'virtType' to an enum, that

Sigh. That was the reason we didn't do that yet. Changing stuff to enum
is likely to break many things.

> caused a build failure on some archs due to comparing an unsigned value
> to < 0.  Adjust the fetch of 'type' to be into temporary 'int virtType'
> and then assign that virtType to the def->virtType
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
> Pushed as build breaker
> 
>  src/conf/domain_conf.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index cdafb14..393ece7 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -14640,7 +14640,7 @@ virDomainDefParseXML(xmlDocPtr xml,
>      xmlNodePtr *nodes = NULL, node = NULL;
>      char *tmp = NULL;
>      size_t i, j;
> -    int n;
> +    int n, virtType;

Please put them on separate lines.

>      long id = -1;
>      virDomainDefPtr def;
>      bool uuid_generated = false;
> @@ -14678,11 +14678,12 @@ virDomainDefParseXML(xmlDocPtr xml,
>          goto error;
>      }
>  
> -    if ((def->virtType = virDomainVirtTypeFromString(tmp)) < 0) {
> +    if ((virtType = virDomainVirtTypeFromString(tmp)) < 0) {
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
>                         _("invalid domain type %s"), tmp);
>          goto error;
>      }
> +    def->virtType = virtType;
>      VIR_FREE(tmp);
>  
>      def->os.bootloader = virXPathString("string(./bootloader)", ctxt);

ACK with the above change.

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150929/dae3cb0d/attachment-0001.sig>


More information about the libvir-list mailing list