diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2016-12-17 08:18:32 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2017-01-04 13:59:15 +1000 |
commit | 8a19c4a78251c5e34ecf508a65d943ca2dc833c7 (patch) | |
tree | 8c9ec992fc36c93a07d4d55ea2418049609f6011 /src/common | |
parent | 67602c4cf7318ba558f07c906ae1223ec7065bf1 (diff) | |
download | pacman-8a19c4a78251c5e34ecf508a65d943ca2dc833c7.tar.xz |
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>
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/ini.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/common/ini.c b/src/common/ini.c index c0979437..e6437de3 100644 --- a/src/common/ini.c +++ b/src/common/ini.c @@ -61,19 +61,14 @@ int parse_ini(const char *file, ini_parser_fn cb, void *data) } while(safe_fgets(line, PATH_MAX, fp)) { - char *key, *value, *ptr; + char *key, *value; size_t line_len; linenum++; - /* ignore whole line and end of line comments */ - if((ptr = strchr(line, '#'))) { - *ptr = '\0'; - } - line_len = strtrim(line); - if(line_len == 0) { + if(line_len == 0 || line[0] == '#') { continue; } |