Remove check whether a variable was already set because the element
is parsed only once now.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/conf/domain_conf.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 639aa430ae..bb4be5d1cd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10918,6 +10918,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
char *haveTLS = NULL;
char *tlsFromConfig = NULL;
bool logParsed = false;
+ bool protocolParsed = false;
int sourceParsed = 0;
for (; cur; cur = cur->next) {
@@ -11032,8 +11033,14 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
logfile = virXMLPropString(cur, "file");
logappend = virXMLPropString(cur, "append");
} else if (virXMLNodeNameEqual(cur, "protocol")) {
- if (!protocol)
- protocol = virXMLPropString(cur, "type");
+ if (protocolParsed) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("only one log element is allowed for "
+ "character device"));
+ goto error;
+ }
+ protocolParsed = true;
+ protocol = virXMLPropString(cur, "type");
}
}
--
2.13.5