]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: diag: run the final diags before quitting when using -c
authorWilly Tarreau <w@1wt.eu>
Sat, 3 Feb 2024 11:05:08 +0000 (12:05 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 3 Feb 2024 11:08:11 +0000 (12:08 +0100)
Final diags were added in 2.4 by commit 5a6926dcf ("MINOR: diag: create
cfgdiag module"), but it's called too late in the startup process,
because when "-c" is passed, the call is not made, while it's its primary
use case. Let's just move the call earlier.

Note that currently the check in this function is limited to verifying
unicity of server cookies in a backend, so it can be backported as far
as 2.4, but there is little value in insisting if it doesn't backport
easily.

src/haproxy.c

index 14140a9ad44811e6871bd7413cc3bc21edf45be4..d11ef021e613c4a362ebdd851bdfe4e55679249d 100644 (file)
@@ -2380,6 +2380,10 @@ static void init(int argc, char **argv)
        if (global.mode & MODE_DUMP_KWD)
                dump_registered_keywords();
 
+       if (global.mode & MODE_DIAG) {
+               cfg_run_diagnostics();
+       }
+
        if (global.mode & MODE_CHECK) {
                struct peers *pr;
                struct proxy *px;
@@ -2415,10 +2419,6 @@ static void init(int argc, char **argv)
        if (global.mode & MODE_DUMP_CFG)
                deinit_and_exit(0);
 
-       if (global.mode & MODE_DIAG) {
-               cfg_run_diagnostics();
-       }
-
 #ifdef USE_OPENSSL
 
        /* Initialize SSL random generator. Must be called before chroot for