ini: only recognize comments at beginning of line

Allows the hash sign to be used in values in config files and hooks.

Fixes #48702

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2016-12-17 08:18:32 -05:00 committed by Allan McRae
parent 67602c4cf7
commit 8a19c4a782

View file

@ -61,19 +61,14 @@ int parse_ini(const char *file, ini_parser_fn cb, void *data)
} }
while(safe_fgets(line, PATH_MAX, fp)) { while(safe_fgets(line, PATH_MAX, fp)) {
char *key, *value, *ptr; char *key, *value;
size_t line_len; size_t line_len;
linenum++; linenum++;
/* ignore whole line and end of line comments */
if((ptr = strchr(line, '#'))) {
*ptr = '\0';
}
line_len = strtrim(line); line_len = strtrim(line);
if(line_len == 0) { if(line_len == 0 || line[0] == '#') {
continue; continue;
} }