]> git.kaiwu.me - haproxy.git/commit
MINOR: server: do not ignore errors during server-template init
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 30 Jul 2026 16:16:11 +0000 (18:16 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 3 Aug 2026 09:11:19 +0000 (11:11 +0200)
commit467440a34f81c635ccb33d434328799b027cbf03
treee04b595905f8d0beeabca9a520389ff88a9d8049
parent83f2d5010221677267debdcfc484750316b91dbc
MINOR: server: do not ignore errors during server-template init

_srv_parse_tmpl_init() is used to duplicate a server several times
according to its template declaration. If an error was encountered
during the duplication of one of these instance, the function was
interrupted. However, no error/warning message is displayed and the
error is silently ignored by caller parse_server().

The objective of this patch is to ensure an error occuring during a
server template allocation is now properly reported. First, an alert is
reported for every failure cases. Also, _srv_parse_tmpl_init() return
type is changed to use an error code. This is used to interrupt server
parsing.

The real benefit of this patch is still pretty limited. The only real
case of error which can happen is an allocation memory issue, likely
detected by a later operation. Also, server_parse_exprs() is also
faillible. However, this was already invoked for the first server
instance via _srv_parse_finalize(). Thus it is unlikely that an error is
reported for the duplicated instances during duplication. Despite this,
the current patch is an improvment as it will allow to extend
_srv_parse_tmpl_init(), for example to check for server name duplication
during parsing on every template instances.
src/server.c