From 05d73aa81c6edd0bd80c49c2e0d5e65ffbc90c2e Mon Sep 17 00:00:00 2001 From: Amaury Denoyelle Date: Mon, 23 Feb 2026 10:10:05 +0100 Subject: [PATCH] MINOR: proxy: improve code when checking server name conflicts During proxy_finalize(), a lookup is performed over the servers by name tree to detect any collision. Only the first conflict for each server instance is reported to avoid a combinatory explosion with too many alerts shown. Previously, this was written using a for loop without any iteration. Replace this by a simple if statement as this is cleaner. This should fix github issue #3276. --- src/proxy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/proxy.c b/src/proxy.c index dadcff0c6..49aa4a2ec 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -2481,14 +2481,13 @@ int proxy_finalize(struct proxy *px, int *err_code) if (!ceb_intree(&newsrv->conf.name_node)) continue; - for (other_srv = newsrv; - (other_srv = cebis_item_prev_dup(&px->conf.used_server_name, conf.name_node, id, other_srv)); ) { + if ((other_srv = cebis_item_prev_dup(&px->conf.used_server_name, conf.name_node, id, newsrv))) { ha_alert("parsing [%s:%d] : %s '%s', another server named '%s' was already defined at line %d, please use distinct names.\n", newsrv->conf.file, newsrv->conf.line, proxy_type_str(px), px->id, newsrv->id, other_srv->conf.line); cfgerr++; - break; + continue; } } -- 2.47.3