]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: cfgparse: keep a single "curproxy"
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Aug 2023 09:18:00 +0000 (11:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 1 Aug 2023 09:31:39 +0000 (11:31 +0200)
Surprisingly, commit 00e00fb42 ("REORG: cfgparse: extract curproxy as a
global variable") caused a build breakage on the CI but not on two
developers' machines. It looks like it's dependent on the linker version
used. What happens is that flt_spoe.c already has a curproxy struct which
already is a copy of the one passed by the parser because it also needed
it to be exported, so they now conflict. Let's just drop this unused copy.

src/cfgparse.c
src/flt_spoe.c

index 2948a51fa1f20e22a4ddcfbe87adf89f3c8ef1cf..7cc829d4680c43ca8ef8f42e99f94b5a2db607e1 100644 (file)
@@ -102,7 +102,7 @@ struct list postparsers = LIST_HEAD_INIT(postparsers);
 extern struct proxy *mworker_proxy;
 
 /* curproxy is only valid during parsing and will be NULL afterwards. */
-struct proxy *curproxy;
+struct proxy *curproxy = NULL;
 
 char *cursection = NULL;
 int cfg_maxpconn = 0;                   /* # of simultaneous connections per proxy (-N) */
index 65f20cec19e162a58bb2faf6415441a268f80516..6fc3023c2a9519fffc0a3784a81cd9ed63c10b00 100644 (file)
@@ -71,9 +71,6 @@ const char *spoe_filter_id = "SPOE filter";
 /* Set if the handle on SIGUSR1 is registered */
 static int sighandler_registered = 0;
 
-/* proxy used during the parsing */
-struct proxy *curproxy = NULL;
-
 /* The name of the SPOE engine, used during the parsing */
 char *curengine = NULL;
 
@@ -4169,12 +4166,11 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
        cfg_register_section("spoe-message", cfg_parse_spoe_message, NULL);
 
        /* Parse SPOE filter configuration file */
+       BUG_ON(px != curproxy);
        curengine = engine;
-       curproxy  = px;
        curagent  = NULL;
        curmsg    = NULL;
        ret = readcfgfile(file);
-       curproxy = NULL;
 
        /* unregister SPOE sections and restore previous sections */
        cfg_unregister_sections();