]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: startup: move confusing msg variable
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 17 Nov 2025 14:54:08 +0000 (15:54 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Tue, 18 Nov 2025 08:43:25 +0000 (09:43 +0100)
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

index 09fe465e61bc471a4abe02f51a4fc63484c087da..fb35ccf40fed238fbb125f522255e083fbfd1766 100644 (file)
@@ -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);