提交 23482e4b 编写于 作者: P Pavel Hrdina

conf: error out for multiple log 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>
上级 21bfd1e9
...@@ -10925,6 +10925,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, ...@@ -10925,6 +10925,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
char *append = NULL; char *append = NULL;
char *haveTLS = NULL; char *haveTLS = NULL;
char *tlsFromConfig = NULL; char *tlsFromConfig = NULL;
bool logParsed = false;
int sourceParsed = 0; int sourceParsed = 0;
for (; cur; cur = cur->next) { for (; cur; cur = cur->next) {
...@@ -11029,10 +11030,15 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, ...@@ -11029,10 +11030,15 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
ctxt->node = saved_node; ctxt->node = saved_node;
} }
} else if (virXMLNodeNameEqual(cur, "log")) { } else if (virXMLNodeNameEqual(cur, "log")) {
if (!logfile) if (logParsed) {
logfile = virXMLPropString(cur, "file"); virReportError(VIR_ERR_XML_ERROR, "%s",
if (!logappend) _("only one protocol element is allowed for "
logappend = virXMLPropString(cur, "append"); "character device"));
goto error;
}
logParsed = true;
logfile = virXMLPropString(cur, "file");
logappend = virXMLPropString(cur, "append");
} else if (virXMLNodeNameEqual(cur, "protocol")) { } else if (virXMLNodeNameEqual(cur, "protocol")) {
if (!protocol) if (!protocol)
protocol = virXMLPropString(cur, "type"); protocol = virXMLPropString(cur, "type");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册