From a2fac5a3a19c5f0edc76f1afd2ac237d864cae2b Mon Sep 17 00:00:00 2001 From: Valentine Krasnobaeva Date: Wed, 9 Oct 2024 23:11:07 +0200 Subject: [PATCH] MINOR: cfgparse: add support for program section This patch is a part of series to reintroduce the program support in the new master-worker architecture. Programs are launched by master, thus only the master process needs its configuration. Therefore, program section parser should be called only in discovery mode, when master parses its configuration. Program section has a post section parser. It should be called only in discovery mode as well. --- src/cfgparse.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index c53e48def..af4149720 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2565,8 +2565,8 @@ int parse_cfg(const struct cfgfile *cfg) if (pcs && pcs->post_section_parser) { int status; - /* for the moment don't call post_section_parser in MODE_DISCOVERY */ - if (global.mode & MODE_DISCOVERY) + /* don't call post_section_parser in MODE_DISCOVERY, except program section */ + if ((global.mode & MODE_DISCOVERY) && (strcmp(pcs->section_name, "program") != 0)) continue; status = pcs->post_section_parser(); @@ -2589,8 +2589,9 @@ int parse_cfg(const struct cfgfile *cfg) } else { int status; - /* for the moment read only the "global" section in MODE_DISCOVERY */ - if ((global.mode & MODE_DISCOVERY) && (strcmp(cs->section_name, "global") != 0)) + /* read only the "global" and "program" sections in MODE_DISCOVERY */ + if (((global.mode & MODE_DISCOVERY) && (strcmp(cs->section_name, "global") != 0) + && (strcmp(cs->section_name, "program") != 0))) continue; status = cs->section_parser(file, linenum, args, kwm);