Code

virt plugin: fix a few build warnings
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 23 Dec 2016 17:47:10 +0000 (18:47 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 23 Dec 2016 17:47:10 +0000 (18:47 +0100)
src/virt.c:939:13: warning: initializing 'char *' with an expression of type 'const char [34]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
      char *bd_xmlpath = "/domain/devices/disk/target[@dev]";
            ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/virt.c:941:20: warning: assigning to 'char *' from 'const char [34]' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
        bd_xmlpath = "/domain/devices/disk/source[@dev]";
                   ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/virt.c

index 4dce6e038836505f7759d673a16a10424b4acd34..830db5136db00a015857a58b53d6d84643d11500 100644 (file)
@@ -936,10 +936,10 @@ static int refresh_lists(struct lv_read_instance *inst) {
       }
 
       /* Block devices. */
-      char *bd_xmlpath = "/domain/devices/disk/target[@dev]";
+      const char *bd_xmlpath = "/domain/devices/disk/target[@dev]";
       if (blockdevice_format == source)
         bd_xmlpath = "/domain/devices/disk/source[@dev]";
-      xpath_obj = xmlXPathEval((xmlChar *)bd_xmlpath, xpath_ctx);
+      xpath_obj = xmlXPathEval((const xmlChar *)bd_xmlpath, xpath_ctx);
 
       if (xpath_obj == NULL || xpath_obj->type != XPATH_NODESET ||
           xpath_obj->nodesetval == NULL)