From: Ján Tomko Date: Fri, 10 Dec 2021 15:30:46 +0000 (+0100) Subject: lxc: fix error value of lxcNodeGetSecurityModel X-Git-Tag: v8.0.0-rc1~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=efe98ca98bb0febe6a8274175b7c5493c0d6c9f3;p=thirdparty%2Flibvirt.git lxc: fix error value of lxcNodeGetSecurityModel When adding the ACL check and caps getter, we assumed that the default return value is -1, not 0 as usual. Fix the return value on error by assigning them explicitly. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 349783ca7c..d86147cc28 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1234,11 +1234,15 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn, memset(secmodel, 0, sizeof(*secmodel)); - if (virNodeGetSecurityModelEnsureACL(conn) < 0) + if (virNodeGetSecurityModelEnsureACL(conn) < 0) { + ret = -1; goto cleanup; + } - if (!(caps = virLXCDriverGetCapabilities(driver, false))) + if (!(caps = virLXCDriverGetCapabilities(driver, false))) { + ret = -1; goto cleanup; + } /* we treat no driver as success, but simply return no data in *secmodel */ if (caps->host.nsecModels == 0