From f0e1cc70830d84e90dd5afa237528df0dad664e4 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Wed, 21 Apr 2021 15:33:24 +0200 Subject: [PATCH] virDomainDeviceBootParseXML: Use virXMLProp* Signed-off-by: Tim Wiederhake Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 87384c52b5..878f489665 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6480,22 +6480,12 @@ static int virDomainDeviceBootParseXML(xmlNodePtr node, virDomainDeviceInfo *info) { - g_autofree char *order = NULL; g_autofree char *loadparm = NULL; - if (!(order = virXMLPropString(node, "order"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("missing boot order attribute")); + if (virXMLPropUInt(node, "order", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &info->bootIndex) < 0) return -1; - } - - if (virStrToLong_uip(order, NULL, 10, &info->bootIndex) < 0 || - info->bootIndex == 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("incorrect boot order '%s', expecting positive integer"), - order); - return -1; - } loadparm = virXMLPropString(node, "loadparm"); if (loadparm) {