]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mworker: does not create the CLI proxy when no listener
authorWilliam Lallemand <wlallemand@haproxy.com>
Tue, 6 Nov 2018 16:37:12 +0000 (17:37 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 6 Nov 2018 17:28:33 +0000 (18:28 +0100)
Does not create the CLI proxy if no -S argument was specified. It
prevents a warning that says that the MASTER proxy does not have any
bind option.

src/cli.c
src/haproxy.c

index 32eaf4688c89f5f09f5c06caf189de499152eeae..e20e0c5bdf237e6f81962ed910dc461d21b36513 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2105,7 +2105,8 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
  */
 void mworker_cli_proxy_stop()
 {
-       stop_proxy(mworker_proxy);
+       if (mworker_proxy)
+               stop_proxy(mworker_proxy);
 }
 
 /*
index 03b267f4e43131a8ec06008e589deb60ae780945..741aa7a386b33f7d05f846b3e270e70c01f72d42 100644 (file)
@@ -1736,6 +1736,8 @@ static void init(int argc, char **argv)
                        tmproc->pid = -1;
                        tmproc->reloads = 0;
                        tmproc->relative_pid = 1 + proc;
+                       tmproc->ipc_fd[0] = -1;
+                       tmproc->ipc_fd[1] = -1;
 
                        if (mworker_cli_sockpair_new(tmproc, proc) < 0) {
                                exit(EXIT_FAILURE);
@@ -1745,22 +1747,25 @@ static void init(int argc, char **argv)
                }
                mworker_env_to_proc_list(); /* get the info of the children in the env */
 
-               if (mworker_cli_proxy_create() < 0) {
-                               ha_alert("Can't create the master's CLI.\n");
-                               exit(EXIT_FAILURE);
-               }
 
-               list_for_each_entry_safe(c, it, &mworker_cli_conf, list) {
+               if (!LIST_ISEMPTY(&mworker_cli_conf)) {
 
-                       if (mworker_cli_proxy_new_listener(c->s) < 0) {
+                       if (mworker_cli_proxy_create() < 0) {
                                ha_alert("Can't create the master's CLI.\n");
                                exit(EXIT_FAILURE);
                        }
-                       LIST_DEL(&c->list);
-                       free(c->s);
-                       free(c);
-               }
 
+                       list_for_each_entry_safe(c, it, &mworker_cli_conf, list) {
+
+                               if (mworker_cli_proxy_new_listener(c->s) < 0) {
+                                       ha_alert("Can't create the master's CLI.\n");
+                                       exit(EXIT_FAILURE);
+                               }
+                               LIST_DEL(&c->list);
+                               free(c->s);
+                               free(c);
+                       }
+               }
        }
 
        pattern_finalize_config();