From 3c49d66d821861a8bb1a2f07336340028edd42f2 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Thu, 10 Feb 2022 23:48:05 -0800 Subject: [PATCH] process: avoid negative number of children The number_of_children child connections number becomes negative (-1) at server startup due to signal handlers treatments on minidlna.c init(). Opening the webserver status page with no clients connected the opening connection shows -1 even if client list show 0 for all in the columns. When connecting the first client, its own connections column goes to 1 and total goes to 0, and so on always one count behind. Simply allow: number_of_children-- only if not 0 From SF user negan07 --- process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/process.c b/process.c index abb777b..f55826a 100644 --- a/process.c +++ b/process.c @@ -123,7 +123,8 @@ process_handle_child_termination(int signal) else break; } - number_of_children--; + if (number_of_children) + number_of_children--; remove_process_info(pid); } }