From b38405d156661620b5c9e36fb968813d6c77ee22 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Mon, 17 Nov 2025 15:54:08 +0100 Subject: [PATCH] CLEANUP: startup: move confusing msg variable Move the char *msg variable declared in main() in a sub-block since there's already multiple msg variable in other sub-blocks in this function. Also make it const. --- src/haproxy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/haproxy.c b/src/haproxy.c index 09fe465e6..fb35ccf40 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -3165,7 +3165,6 @@ int main(int argc, char **argv) struct cfgfile *cfg, *cfg_tmp; struct ring *tmp_startup_logs = NULL; struct mworker_proc *proc; - char *msg = "READY\n"; /* Catch broken toolchains */ if (sizeof(long) != sizeof(void *) || (intovf + 0x7FFFFFFF >= intovf)) { @@ -3712,6 +3711,8 @@ int main(int argc, char **argv) * message received from the worker to the launching process, see _send_status(). */ if ((global.mode & MODE_DAEMON) && !(global.mode & MODE_MWORKER)) { + const char *msg = "READY\n"; + if (write(daemon_fd[1], msg, strlen(msg)) < 0) { ha_alert("[%s.main()] Failed to write into pipe with parent process: %s\n", progname, strerror(errno)); exit(1); -- 2.47.3