[pve-devel] [PATCH qemu-server 2/2] qmeventd: further improve getting vmid from PID

Fiona Ebner f.ebner at proxmox.com
Mon Jul 10 09:58:25 CEST 2023


by also expecting the ".scope" part and trying the next entry if it is
not present instead of immediately failing.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 qmeventd/qmeventd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/qmeventd/qmeventd.c b/qmeventd/qmeventd.c
index 503bce69..7e9b2354 100644
--- a/qmeventd/qmeventd.c
+++ b/qmeventd/qmeventd.c
@@ -128,12 +128,12 @@ get_vmid_from_pid(pid_t pid)
 	errno = 0;
 	char *endptr = NULL;
 	vmid = strtoul(vmid_start, &endptr, 10);
+	if (!endptr || strncmp(endptr, ".scope", 6)) {
+	    continue;
+	}
 	if (errno != 0) {
 	    fprintf(stderr, "error parsing vmid for %d: %s\n", pid, strerror(errno));
 	    vmid = 0;
-	} else if (*endptr != '.') {
-	    fprintf(stderr, "unexpected cgroup entry %s\n", buf);
-	    vmid = 0;
 	}
 
 	goto ret;
-- 
2.39.2






More information about the pve-devel mailing list