5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-03 01:17:58 +03:00

qmeventd: VMID from PID: avoid goto

If strtol() returns an errno, make sure not to print the error message
twice after the refactoring.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2023-07-10 10:53:02 +02:00 committed by Wolfgang Bumiller
parent aaa77c9f7a
commit 742da46a44

View File

@ -134,20 +134,18 @@ get_vmid_from_pid(pid_t pid)
continue;
}
if (errno != 0) {
fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
vmid = 0;
}
goto ret;
break;
}
if (errno) {
fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
} else {
} else if (!vmid) {
fprintf(stderr, "error parsing vmid for %d: no matching qemu.slice cgroup entry\n", pid);
}
ret:
free(buf);
fclose(fp);
return vmid;