diff options
author | 2021-05-21 08:56:45 -0400 | |
---|---|---|
committer | 2021-05-21 08:56:45 -0400 | |
commit | d8d016dc44648fe185577ff82433a32fb17081f7 (patch) | |
tree | b4786ab1a7e42ff487e0ee8286c66b0143cdc26b /src | |
parent | --buid fixes (diff) | |
download | firejail-d8d016dc44648fe185577ff82433a32fb17081f7.tar.gz firejail-d8d016dc44648fe185577ff82433a32fb17081f7.tar.zst firejail-d8d016dc44648fe185577ff82433a32fb17081f7.zip |
support trailing comments on profile lines
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/profile.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index dd4506ac1..38e94c074 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -1714,13 +1714,17 @@ void profile_read(const char *fname) { | |||
1714 | int lineno = 0; | 1714 | int lineno = 0; |
1715 | while (fgets(buf, MAX_READ, fp)) { | 1715 | while (fgets(buf, MAX_READ, fp)) { |
1716 | ++lineno; | 1716 | ++lineno; |
1717 | |||
1718 | // remove comments | ||
1719 | char *ptr = strchr(buf, '#'); | ||
1720 | if (ptr) | ||
1721 | *ptr = '\0'; | ||
1722 | |||
1717 | // remove empty space - ptr in allocated memory | 1723 | // remove empty space - ptr in allocated memory |
1718 | char *ptr = line_remove_spaces(buf); | 1724 | ptr = line_remove_spaces(buf); |
1719 | if (ptr == NULL) | 1725 | if (ptr == NULL) |
1720 | continue; | 1726 | continue; |
1721 | 1727 | if (*ptr == '\0') { | |
1722 | // comments | ||
1723 | if (*ptr == '#' || *ptr == '\0') { | ||
1724 | free(ptr); | 1728 | free(ptr); |
1725 | continue; | 1729 | continue; |
1726 | } | 1730 | } |