]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: mworker_cli_proxy_new_listener() returns a bind_conf
authorWilliam Lallemand <wlallemand@haproxy.org>
Sat, 24 Sep 2022 13:51:27 +0000 (15:51 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Sat, 24 Sep 2022 13:51:27 +0000 (15:51 +0200)
mworker_cli_proxy_new_listener() now returns a bind_conf * or NULL upon
failure.

include/haproxy/cli.h
src/cli.c
src/haproxy.c

index 444c09b66c2f705929cb4ea77d3fe995e8803457..844df15e5e90ed57e47ade6e389781861041c968 100644 (file)
@@ -42,7 +42,7 @@ int cli_parse_default(char **args, char *payload, struct appctx *appctx, void *p
 /* mworker proxy functions */
 
 int mworker_cli_proxy_create(void);
-int mworker_cli_proxy_new_listener(char *line);
+struct bind_conf *mworker_cli_proxy_new_listener(char *line);
 int mworker_cli_sockpair_new(struct mworker_proc *mworker_proc, int proc);
 void mworker_cli_proxy_stop(void);
 
index d238a23a1f430f9c24f8340616903592f118844c..c0d8efabfc6b05b2e5656e1521ae57042e39bf6e 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -3076,7 +3076,7 @@ error_proxy:
 /*
  * Create a new listener for the master CLI proxy
  */
-int mworker_cli_proxy_new_listener(char *line)
+struct bind_conf *mworker_cli_proxy_new_listener(char *line)
 {
        struct bind_conf *bind_conf;
        struct listener *l;
@@ -3165,13 +3165,13 @@ int mworker_cli_proxy_new_listener(char *line)
        }
        global.maxsock += mworker_proxy->maxconn;
 
-       return 0;
+       return bind_conf;
 
 err:
        ha_alert("%s\n", err);
        free(err);
        free(bind_conf);
-       return -1;
+       return NULL;
 
 }
 
index 9b3b37f7b263ef008f498e6a486c245e578eec0d..93502160f416991f6259966c969b74bc5d893669 100644 (file)
@@ -2121,7 +2121,7 @@ static void init(int argc, char **argv)
 
                        list_for_each_entry_safe(c, it, &mworker_cli_conf, list) {
 
-                               if (mworker_cli_proxy_new_listener(c->s) < 0) {
+                               if (mworker_cli_proxy_new_listener(c->s) == NULL) {
                                        ha_alert("Can't create the master's CLI.\n");
                                        exit(EXIT_FAILURE);
                                }
@@ -2131,8 +2131,7 @@ static void init(int argc, char **argv)
                        }
                        /* Create the mcli_reload listener from the proc_self struct */
                        memprintf(&path, "sockpair@%d", proc_self->ipc_fd[1]);
-
-                       if (mworker_cli_proxy_new_listener(path) < 0) {
+                       if (mworker_cli_proxy_new_listener(path) == NULL) {
                                ha_alert("Cannot create the mcli_reload listener.\n");
                                exit(EXIT_FAILURE);
                        }