1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-03-01 01:41:52 -05:00

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 <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2010-05-17 19:10:50 +02:00 committed by Dan McGee
parent df842e11cf
commit 3a85f83840

View File

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