From: Kristina Hanicova Date: Fri, 21 May 2021 11:41:30 +0000 (+0200) Subject: qemu: Return -EINVAL to keep qemuDomainOpenFile() consistent X-Git-Tag: v7.4.0-rc1~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6b6725c95b3e9fbdc5d1683f00355bf0d13f0a0;p=thirdparty%2Flibvirt.git qemu: Return -EINVAL to keep qemuDomainOpenFile() consistent 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 Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 10641846b3..5254552551 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -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);