Allow comments after repo section header in pacman.conf
Pacman assumes that the final character of a line specifing a repo in pacman.conf is a "]". But it did not clean whitespace from the line after removing any comments. So lines like: [allanbrokeit] # could break system caused pacman not to recognize the repo. Adjust config parsing to strip comments before trimming whitespace from the end of the string. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
67290441b8
commit
d95c04945f
1 changed files with 7 additions and 5 deletions
|
@ -719,16 +719,18 @@ static int _parseconfig(const char *file, struct section_t *section,
|
||||||
size_t line_len;
|
size_t line_len;
|
||||||
|
|
||||||
linenum++;
|
linenum++;
|
||||||
|
|
||||||
|
/* ignore whole line and end of line comments */
|
||||||
|
if((ptr = strchr(line, '#'))) {
|
||||||
|
*ptr = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
strtrim(line);
|
strtrim(line);
|
||||||
line_len = strlen(line);
|
line_len = strlen(line);
|
||||||
|
|
||||||
/* ignore whole line and end of line comments */
|
if(line_len == 0) {
|
||||||
if(line_len == 0 || line[0] == '#') {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if((ptr = strchr(line, '#'))) {
|
|
||||||
*ptr = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(line[0] == '[' && line[line_len - 1] == ']') {
|
if(line[0] == '[' && line[line_len - 1] == ']') {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
Loading…
Add table
Reference in a new issue