]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Return -EINVAL to keep qemuDomainOpenFile() consistent
authorKristina Hanicova <khanicov@redhat.com>
Fri, 21 May 2021 11:41:30 +0000 (13:41 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 21 May 2021 12:38:09 +0000 (14:38 +0200)
The description of the function says that the return value is a
file descriptor on success and negative errno on failure which is
not true. If the 'if' case with check on security labels fails,
the return value is -1 not -errno. The solution is to return
'-EINVAL' instead.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_domain.c

index 10641846b34cba03a049b729107c2f16e78c31ad..5254552551818b075249aace0fd524674bed4423 100644 (file)
@@ -11509,7 +11509,7 @@ qemuDomainOpenFile(virQEMUDriver *driver,
         (seclabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) != NULL &&
         seclabel->label != NULL &&
         (virParseOwnershipIds(seclabel->label, &user, &group) < 0))
-        return -1;
+        return -EINVAL;
 
     return virQEMUFileOpenAs(user, group, dynamicOwnership,
                              path, oflags, needUnlink);