mirror of
git://git.proxmox.com/git/qemu-server.git
synced 2025-01-03 01:17:58 +03:00
qmeventd: further improve getting VMID from PID
by also expecting the ".scope" part and trying the next entry if it is not present instead of immediately failing. 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:
parent
d0b587533c
commit
a9f2e2d6f9
@ -128,12 +128,14 @@ get_vmid_from_pid(pid_t pid)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
char *endptr = NULL;
|
char *endptr = NULL;
|
||||||
vmid = strtoul(vmid_start, &endptr, 10);
|
vmid = strtoul(vmid_start, &endptr, 10);
|
||||||
|
if (!endptr || strncmp(endptr, ".scope", 6)) {
|
||||||
|
fprintf(stderr, "unexpected cgroup entry %s\n", buf);
|
||||||
|
vmid = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
|
fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
|
||||||
vmid = 0;
|
vmid = 0;
|
||||||
} else if (*endptr != '.') {
|
|
||||||
fprintf(stderr, "unexpected cgroup entry %s\n", buf);
|
|
||||||
vmid = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ret;
|
goto ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user