mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
conf: Restore error checking in VideoAccelDefParseXML()
The check that ensures that at least one property among accel3d,
accel2d and rendernode has been provided by the user had been
lost during the conversion to virXMLPropTristateBool().
Fixes: 0fe2d8dd33
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
2ad7039e7c
commit
77c638c3c7
@ -14025,23 +14025,31 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
|
||||
{
|
||||
g_autofree virDomainVideoAccelDef *def = NULL;
|
||||
g_autofree char *rendernode = NULL;
|
||||
virTristateBool accel3d;
|
||||
virTristateBool accel2d;
|
||||
|
||||
rendernode = virXMLPropString(node, "rendernode");
|
||||
if (virXMLPropTristateBool(node, "accel3d",
|
||||
VIR_XML_PROP_NONE, &accel3d) < 0)
|
||||
return NULL;
|
||||
if (virXMLPropTristateBool(node, "accel2d",
|
||||
VIR_XML_PROP_NONE, &accel2d) < 0)
|
||||
return NULL;
|
||||
|
||||
if (!rendernode &&
|
||||
accel3d == VIR_TRISTATE_BOOL_ABSENT &&
|
||||
accel2d == VIR_TRISTATE_BOOL_ABSENT) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("missing values for acceleration"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
def = g_new0(virDomainVideoAccelDef, 1);
|
||||
|
||||
if (virXMLPropTristateBool(node, "accel3d",
|
||||
VIR_XML_PROP_NONE,
|
||||
&def->accel3d) < 0)
|
||||
return NULL;
|
||||
|
||||
if (virXMLPropTristateBool(node, "accel2d",
|
||||
VIR_XML_PROP_NONE,
|
||||
&def->accel2d) < 0)
|
||||
return NULL;
|
||||
|
||||
if (rendernode)
|
||||
def->rendernode = virFileSanitizePath(rendernode);
|
||||
def->accel3d = accel3d;
|
||||
def->accel2d = accel2d;
|
||||
|
||||
return g_steal_pointer(&def);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user