[libvirt] [PATCH 2/3] Use new util function to check network name

Sławek Kapłoński slawek at kaplonski.pl
Wed Oct 19 20:57:47 UTC 2016


New util function virXMLNodeHasIllegalChars is now used to test if
parsed network contains illegal char '/' in it's name.
---
 src/conf/network_conf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index aa39776..bd934f1 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2117,11 +2117,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
         goto error;
     }
 
-    if (strchr(def->name, '/')) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("name %s cannot contain '/'"), def->name);
+    if (virXMLNodeHasIllegalChars("name", def->name, "/"))
         goto error;
-    }
 
     /* Extract network uuid */
     tmp = virXPathString("string(./uuid[1])", ctxt);
-- 
2.10.0




More information about the libvir-list mailing list