From: Andrea Bolognani Date: Thu, 24 Mar 2022 18:49:40 +0000 (+0100) Subject: qemu: Format conditionally X-Git-Tag: v8.3.0-rc1~169 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c49651ac1772627349dccb9274a35befbcb473f9;p=thirdparty%2Flibvirt.git qemu: Format conditionally If the value is VIR_TRISTATE_BOOL_ABSENT we should just omit the element entirely. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1bfea0d470..39da3cbb62 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2205,9 +2205,10 @@ void qemuDomainObjPrivateXMLFormatAllowReboot(virBuffer *buf, virTristateBool allowReboot) { - virBufferAsprintf(buf, "\n", - virTristateBoolTypeToString(allowReboot)); - + if (allowReboot) { + virBufferAsprintf(buf, "\n", + virTristateBoolTypeToString(allowReboot)); + } }