]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc: fix error value of lxcNodeGetSecurityModel
authorJán Tomko <jtomko@redhat.com>
Fri, 10 Dec 2021 15:30:46 +0000 (16:30 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 13 Dec 2021 13:44:00 +0000 (14:44 +0100)
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 <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/lxc/lxc_driver.c

index 349783ca7ce1a3961b45f9449a7f7176394bb615..d86147cc28d214454af49494e38f2bd492c8606c 100644 (file)
@@ -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