From: William Lallemand Date: Mon, 17 Feb 2025 09:59:46 +0000 (+0100) Subject: BUG/MINOR: startup: leave at first post_section_parser which fails X-Git-Tag: v3.2-dev6~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7268e9c2495020d4d9d6feca086fc1584954d792;p=thirdparty%2Fhaproxy.git BUG/MINOR: startup: leave at first post_section_parser which fails Since we are now iterating on post_section_parser() for a same keyword, we need to exit at the first ERR_ABORT. The post_section_parser() is called when parsing a new section, but also at the end of the file to be called for the last section. The changes in 4de86bb ("MEDIUM: initcall: allow to register mutiple post_section_parser per section") should have added tests on the ERR_ABORT value. Also pcs->post_section_parser() must be called instead of cs->post_section_parser() because we could have a NULL ptr. This bug does not affect anything since we don't use REGISTER_CONFIG_POST_SECTION() yet. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index acd581058..381759a2a 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2639,6 +2639,7 @@ section_parser: /* call post_section_parser of the last section when there is no more lines */ if (cs) { struct cfg_section *psect; + int status; /* don't call post_section_parser in MODE_DISCOVERY */ if (!(global.mode & MODE_DISCOVERY)) { @@ -2646,7 +2647,15 @@ section_parser: if (strcmp(cs->section_name, psect->section_name) == 0 && psect->post_section_parser) { - err_code |= cs->post_section_parser(); + status = psect->post_section_parser(); + if (status & ERR_FATAL) + fatal++; + + err_code |= status; + + if (err_code & ERR_ABORT) + goto err; + } } }