Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4f020714bc..9b4c083801 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -18806,14 +18806,15 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
virDomainLoaderDefPtr loader,
bool fwAutoSelect)
{
- g_autofree char *readonly_str = NULL;
- g_autofree char *secure_str = NULL;
g_autofree char *type_str = NULL;
-
- secure_str = virXMLPropString(node, "secure");
+ virTristateBool readonly = VIR_TRISTATE_BOOL_ABSENT;
+ virTristateBool secure = VIR_TRISTATE_BOOL_ABSENT;
if (!fwAutoSelect) {
- readonly_str = virXMLPropString(node, "readonly");
+ if (virXMLPropYesNo(node, "readonly", &readonly) < 0)
+ return -1;
+ loader->readonly = readonly;
+
type_str = virXMLPropString(node, "type");
if (!(loader->path = virXMLNodeContentString(node)))
return -1;
@@ -18822,19 +18823,9 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
VIR_FREE(loader->path);
}
- if (readonly_str &&
- (loader->readonly = virTristateBoolTypeFromString(readonly_str)) <= 0) {
- virReportError(VIR_ERR_XML_DETAIL,
- _("unknown readonly value: %s"), readonly_str);
+ if (virXMLPropYesNo(node, "secure", &secure) < 0)
return -1;
- }
-
- if (secure_str &&
- (loader->secure = virTristateBoolTypeFromString(secure_str)) <= 0) {
- virReportError(VIR_ERR_XML_DETAIL,
- _("unknown secure value: %s"), secure_str);
- return -1;
- }
+ loader->secure = secure;
if (type_str) {
int type;
--
2.26.2