1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu_passt: Report error when getting passt PID failed

If qemuPasstGetPid() fails, or the passt's PID is -1 then
qemuPasstSetupCgroup() returns early without any error message
set. Report an appropriate error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
Michal Privoznik 2023-02-13 16:05:04 +01:00
parent b7b058d5f4
commit 598a73335d

View File

@ -125,8 +125,11 @@ qemuPasstSetupCgroup(virDomainObj *vm,
{
pid_t pid = (pid_t) -1;
if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <= 0)
if (qemuPasstGetPid(vm, net, &pid) < 0 || pid <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Could not get process ID of passt"));
return -1;
}
return virCgroupAddProcess(cgroup, pid);
}