mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-26 05:12:20 +00:00
lxc: remove cleanup from lxcNodeGetSecurityModel
Return the values directly. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
319c5f0e97
commit
1852cee52b
@ -1220,32 +1220,26 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virLXCDriver *driver = conn->privateData;
|
virLXCDriver *driver = conn->privateData;
|
||||||
g_autoptr(virCaps) caps = NULL;
|
g_autoptr(virCaps) caps = NULL;
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
memset(secmodel, 0, sizeof(*secmodel));
|
memset(secmodel, 0, sizeof(*secmodel));
|
||||||
|
|
||||||
if (virNodeGetSecurityModelEnsureACL(conn) < 0) {
|
if (virNodeGetSecurityModelEnsureACL(conn) < 0)
|
||||||
ret = -1;
|
return -1;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(caps = virLXCDriverGetCapabilities(driver, false))) {
|
if (!(caps = virLXCDriverGetCapabilities(driver, false)))
|
||||||
ret = -1;
|
return -1;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we treat no driver as success, but simply return no data in *secmodel */
|
/* we treat no driver as success, but simply return no data in *secmodel */
|
||||||
if (caps->host.nsecModels == 0
|
if (caps->host.nsecModels == 0
|
||||||
|| caps->host.secModels[0].model == NULL)
|
|| caps->host.secModels[0].model == NULL)
|
||||||
goto cleanup;
|
return 0;
|
||||||
|
|
||||||
if (virStrcpy(secmodel->model, caps->host.secModels[0].model,
|
if (virStrcpy(secmodel->model, caps->host.secModels[0].model,
|
||||||
VIR_SECURITY_MODEL_BUFLEN) < 0) {
|
VIR_SECURITY_MODEL_BUFLEN) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("security model string exceeds max %d bytes"),
|
_("security model string exceeds max %d bytes"),
|
||||||
VIR_SECURITY_MODEL_BUFLEN - 1);
|
VIR_SECURITY_MODEL_BUFLEN - 1);
|
||||||
ret = -1;
|
return -1;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrcpy(secmodel->doi, caps->host.secModels[0].doi,
|
if (virStrcpy(secmodel->doi, caps->host.secModels[0].doi,
|
||||||
@ -1253,12 +1247,10 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn,
|
|||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("security DOI string exceeds max %d bytes"),
|
_("security DOI string exceeds max %d bytes"),
|
||||||
VIR_SECURITY_DOI_BUFLEN-1);
|
VIR_SECURITY_DOI_BUFLEN-1);
|
||||||
ret = -1;
|
return -1;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
return 0;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user