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 <khanicov@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Kristina Hanicova 2021-05-21 13:41:30 +02:00 committed by Michal Privoznik
parent bcdaa91a27
commit b6b6725c95

View 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);