From: Christopher Faulet Date: Mon, 2 Nov 2020 21:04:55 +0000 (+0100) Subject: MINOR: server: Copy configuration file and line for server templates X-Git-Tag: v2.1.10~5 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=aa02be83a9cafe304a1b6b5e4e4f2243d4d03b53;p=haproxy-2.1.git MINOR: server: Copy configuration file and line for server templates When servers based on server templates are initialized, the configuration file and line are now copied. This helps to emit understandable warning and alert messages. This patch may be backported if needed, as far as 1.8. (cherry picked from commit 75bef00538eebc00c22309c7f9391c0f6d502ac0) Signed-off-by: Christopher Faulet (cherry picked from commit 97ae0cf4b20b50fa668e641126c6a65b587359d9) Signed-off-by: Christopher Faulet --- diff --git a/src/server.c b/src/server.c index 0ee5a50..25f30ce 100644 --- a/src/server.c +++ b/src/server.c @@ -1982,6 +1982,9 @@ static int server_template_init(struct server *srv, struct proxy *px) if (!newsrv) goto err; + newsrv->conf.file = strdup(srv->conf.file); + newsrv->conf.line = srv->conf.line; + srv_settings_cpy(newsrv, srv, 1); srv_prepare_for_resolution(newsrv, srv->hostname); #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME