提交 209fa11b 编写于 作者: P Pavel Hrdina

conf: error out for multiple protocol elements while parsing chardev

Remove check whether a variable was already set because the element
is parsed only once now.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 23482e4b
......@@ -10926,6 +10926,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
char *haveTLS = NULL;
char *tlsFromConfig = NULL;
bool logParsed = false;
bool protocolParsed = false;
int sourceParsed = 0;
for (; cur; cur = cur->next) {
......@@ -11040,7 +11041,13 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
logfile = virXMLPropString(cur, "file");
logappend = virXMLPropString(cur, "append");
} else if (virXMLNodeNameEqual(cur, "protocol")) {
if (!protocol)
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");
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册