]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mworker: post_section_parser for the last section in discovery
authorWilliam Lallemand <wlallemand@haproxy.com>
Wed, 12 Feb 2025 11:31:11 +0000 (12:31 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Wed, 12 Feb 2025 11:34:57 +0000 (12:34 +0100)
Previous patch 2c270a05f ("BUG/MINOR: mworker: section ignored in
discovery after a post_section_parser") needs an adjustment for the last
section of the file.

Indeed the post_section_parser of the last section must not be called in
discovery mode.

Must be backported in 3.1.

src/cfgparse.c

index 9b9718258fe8f696477dc289414d6137c4f1e081..cbd006bb7da585d6569dd093530ff46b08647bee 100644 (file)
@@ -2623,8 +2623,13 @@ section_parser:
        }
 
        ha_free(&global.cfg_curr_section);
-       if (cs && cs->post_section_parser)
-               err_code |= cs->post_section_parser();
+
+       /* call post_section_parser of the last section when there is no more lines */
+       if (cs && cs->post_section_parser) {
+               /* don't call post_section_parser in MODE_DISCOVERY */
+               if (!(global.mode & MODE_DISCOVERY))
+                       err_code |= cs->post_section_parser();
+       }
 
        if (nested_cond_lvl) {
                ha_alert("parsing [%s:%d]: non-terminated '.if' block.\n", file, linenum);