From: Peter Krempa Date: Thu, 6 May 2021 14:01:32 +0000 (+0200) Subject: virDomainBackupDiskDefParseXML: Fill default backup state after parsing it X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=46e6542a927e3bee8955007b1d83ca187691250e;p=libvirt.git virDomainBackupDiskDefParseXML: Fill default backup state after parsing it Set the backup mode to VIR_TRISTATE_BOOL_YES after virXMLPropTristateBool left it set to VIR_TRISTATE_BOOL_ABSENT. This will allow fixing virXMLPropTristateBool to always initialize @result. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 7f176b783f..ac92bd4f26 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -121,12 +121,13 @@ virDomainBackupDiskDefParseXML(xmlNodePtr node, return -1; } - def->backup = VIR_TRISTATE_BOOL_YES; - if (virXMLPropTristateBool(node, "backup", VIR_XML_PROP_NONE, &def->backup) < 0) return -1; + if (def->backup == VIR_TRISTATE_BOOL_ABSENT) + def->backup = VIR_TRISTATE_BOOL_YES; + /* don't parse anything else if backup is disabled */ if (def->backup == VIR_TRISTATE_BOOL_NO) return 0;