]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: startup: don't fork worker if started with -c -W
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Tue, 29 Oct 2024 18:14:11 +0000 (19:14 +0100)
committerValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 30 Oct 2024 08:59:59 +0000 (09:59 +0100)
Don't do master-worker fork if MODE_CHECK is detected from the command line along
with the master-worker mode. We should exit in MODE_CHECK, after the
configuration parsing and validation. So, with the new master-worker architecture
it's better to align this mode with the standalone.

This patch does not need to be backported, as related to the latest
master-worker rework.

src/haproxy.c

index bef1c46ca43d82d0142fc66c2767c33272c5a34a..4bc6e4d0386f5afbd13b18b07581542956932e69 100644 (file)
@@ -3150,6 +3150,12 @@ static void read_cfg_in_discovery_mode(int argc, char **argv)
                ha_alert("a master CLI socket was defined, but master-worker mode (-W) is not enabled.\n");
                exit(EXIT_FAILURE);
        }
+
+       /* in MODE_CHECK and in MODE_DUMP_CFG we just need to parse the
+        * configuration and exit, see step_init_2()
+        */
+       if ((global.mode & MODE_MWORKER) && (global.mode & (MODE_CHECK | MODE_DUMP_CFG)))
+               global.mode &= ~MODE_MWORKER;
 }
 
 void deinit(void)