Use the helper to avoid doing this in the parser.
---
src/conf/domain_conf.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index da04b7b..0689eff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2365,6 +2365,13 @@ static int
virDomainDefUpdateDefaultsInternal(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED)
{
+ /* verify the domain title */
+ if (def->title && strchr(def->title, '\n')) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Domain title can't contain newlines"));
+ return -1;
+ }
+
/* Auto-add any implied controllers which aren't present */
if (virDomainDefAddImplicitControllers(def) < 0)
return -1;
@@ -9314,12 +9321,6 @@ virDomainDefParseXML(virCapsPtr caps,
/* Extract short description of domain (title) */
def->title = virXPathString("string(./title[1])", ctxt);
- if (def->title && strchr(def->title, '\n')) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("Domain title can't contain newlines"));
- goto error;
- }
-
/* Extract documentation if present */
def->description = virXPathString("string(./description[1])", ctxt);
--
1.8.1.1