From 698d5ea08a15d2d28260136d1e80a3b36c8d3005 Mon Sep 17 00:00:00 2001
From: Alexander Stephan <alexander.stephan@sap.com>
Date: Thu, 11 Dec 2025 10:00:11 +0000
Subject: [PATCH 1/4] CLEANUP: mworker/cli: only keep positive PIDs in
 proc_list

Change mworker_env_to_proc_list() to if (child->pid > 0) before
LIST_APPEND, avoiding invalid PIDs (0/-1) in the process list.
This has no functional impact beyond stricter validation and it aligns
with existing kill safeguards.
---
 src/mworker.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mworker.c b/src/mworker.c
index 6aed15f3f..2ff415a8b 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -223,7 +223,7 @@ int mworker_env_to_proc_list()
 				child->version = strdup(subtoken+8);
 			}
 		}
-		if (child->pid) {
+		if (child->pid > 0) {
 			LIST_APPEND(&proc_list, &child->list);
 		} else {
 			mworker_free_child(child);
@@ -909,6 +909,7 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
 	/* dump complete */
 	return 1;
 }
+
 /* reload the master process */
 static int cli_parse_show_proc(char **args, char *payload, struct appctx *appctx, void *private)
 {
-- 
2.43.7

