]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker/cli: only keep positive PIDs in proc_list
authorAlexander Stephan <alexander.stephan@sap.com>
Thu, 11 Dec 2025 10:00:11 +0000 (10:00 +0000)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 5 Jan 2026 07:59:14 +0000 (08:59 +0100)
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

index 6aed15f3f8bdc94fa872da598188af4db27668a3..2ff415a8bf9cc21801d99443da0605cc70fbbe13 100644 (file)
@@ -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)
 {