Split up formatting of the '<address>' element rather that trying to
optimize it with formatting string hacks.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b337bba534..7b181e0587 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -26134,11 +26134,13 @@ virDomainHostdevDefFormatSubsysSCSI(virBufferPtr buf,
} else {
virBufferAsprintf(&sourceChildBuf, "<adapter
name='%s'/>\n",
scsihostsrc->adapter);
- virBufferAsprintf(&sourceChildBuf,
- "<address %sbus='%u' target='%u'
unit='%llu'/>\n",
- includeTypeInAddr ? "type='scsi' " :
"",
- scsihostsrc->bus, scsihostsrc->target,
- scsihostsrc->unit);
+
+ virBufferAddLit(&sourceChildBuf, "<address");
+ if (includeTypeInAddr)
+ virBufferAddLit(&sourceChildBuf, " type='scsi'");
+ virBufferAsprintf(&sourceChildBuf, " bus='%u'
target='%u' unit='%llu'",
+ scsihostsrc->bus, scsihostsrc->target,
scsihostsrc->unit);
+ virBufferAddLit(&sourceChildBuf, "/>\n");
}
virXMLFormatElement(buf, "source", &sourceAttrBuf,
&sourceChildBuf);
--
2.26.2