Remove check whether a variable was already set because the element
is parsed only once now.

Signed-off-by: Pavel Hrdina <phrd...@redhat.com>
---
 src/conf/domain_conf.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 651a049cf1..639aa430ae 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10917,6 +10917,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr 
def,
     char *append = NULL;
     char *haveTLS = NULL;
     char *tlsFromConfig = NULL;
+    bool logParsed = false;
     int sourceParsed = 0;
 
     for (; cur; cur = cur->next) {
@@ -11021,10 +11022,15 @@ 
virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
                 ctxt->node = saved_node;
             }
         } else if (virXMLNodeNameEqual(cur, "log")) {
-            if (!logfile)
-                logfile = virXMLPropString(cur, "file");
-            if (!logappend)
-                logappend = virXMLPropString(cur, "append");
+            if (logParsed) {
+                virReportError(VIR_ERR_XML_ERROR, "%s",
+                               _("only one protocol element is allowed for "
+                                 "character device"));
+                goto error;
+            }
+            logParsed = true;
+            logfile = virXMLPropString(cur, "file");
+            logappend = virXMLPropString(cur, "append");
         } else if (virXMLNodeNameEqual(cur, "protocol")) {
             if (!protocol)
                 protocol = virXMLPropString(cur, "type");
-- 
2.13.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to