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: don't fail immediately when encountering unexpected entry

While such entries shuoldn't exist in practice without manually
messing around, it's not hard to imagine, and there's still a good
chance the actual VMID can still be found.

It's still unexpected to encounter such entries so keep the log line.

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

View File

@ -105,7 +105,7 @@ get_vmid_from_pid(pid_t pid)
char *cgroup_path = strrchr(buf, ':');
if (!cgroup_path) {
fprintf(stderr, "unexpected cgroup entry %s\n", buf);
goto ret;
continue;
}
cgroup_path++;
@ -116,13 +116,13 @@ get_vmid_from_pid(pid_t pid)
char *vmid_start = strrchr(buf, '/');
if (!vmid_start) {
fprintf(stderr, "unexpected cgroup entry %s\n", buf);
goto ret;
continue;
}
vmid_start++;
if (vmid_start[0] == '-' || vmid_start[0] == '\0') {
fprintf(stderr, "invalid vmid in cgroup entry %s\n", buf);
goto ret;
continue;
}
errno = 0;