From 3a85f83840888cbab09f2413fa3eb7c3b71055e5 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Mon, 17 May 2010 19:10:50 +0200 Subject: Allow Include directive in any sections Fix a regression of 51f9e5e40a7 that only allowed Include in repo sections. Thanks to Marc - A. Dahlhaus for reporting the issue. Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/pacman.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 09a81059..6ecda052 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -959,7 +959,21 @@ static int _parseconfig(const char *file, const char *givensection, ret = 1; goto cleanup; } + /* Include is allowed in both options and repo sections */ + if(strcmp(key, "Include") == 0) { + if(value == NULL) { + pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive %s needs a value\n"), + file, linenum, key); + ret = 1; + goto cleanup; + } + pm_printf(PM_LOG_DEBUG, "config: including %s\n", value); + /* Ignore include failures... assume non-critical */ + _parseconfig(value, section, db); + continue; + } if(strcmp(section, "options") == 0) { + /* we are either in options ... */ if((ret = _parse_options(key, value)) != 0) { pm_printf(PM_LOG_ERROR, _("config file %s, line %d: problem in options section\n"), file, linenum); @@ -968,18 +982,8 @@ static int _parseconfig(const char *file, const char *givensection, } continue; } else { - /* we are in a repo section */ - if(strcmp(key, "Include") == 0) { - if(value == NULL) { - pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive %s needs a value\n"), - file, linenum, key); - ret = 1; - goto cleanup; - } - pm_printf(PM_LOG_DEBUG, "config: including %s\n", value); - _parseconfig(value, section, db); - /* Ignore include failures... assume non-critical */ - } else if(strcmp(key, "Server") == 0) { + /* ... or in a repo section */ + if(strcmp(key, "Server") == 0) { if(value == NULL) { pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive %s needs a value\n"), file, linenum, key); -- cgit v1.2.3-24-g4f1b