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.
This commit is contained in:
William Lallemand 2025-02-17 10:59:46 +01:00
parent 32691e7c25
commit 7268e9c249

View File

@ -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;
}
}
}