From 5f33b73d4e29df5c0e5d52986e273501bd99fdad Mon Sep 17 00:00:00 2001 From: Mygod Date: Fri, 30 Dec 2016 15:39:07 +0800 Subject: [PATCH] Add support for comments in the middle of the line in ACL files --- src/acl.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/acl.c b/src/acl.c index 60d4b727..d790f401 100644 --- a/src/acl.c +++ b/src/acl.c @@ -396,13 +396,12 @@ init_acl(const char *path) buf[len - 1] = '\0'; } - char *line = trimwhitespace(buf); - - // Skip comments - if (line[0] == '#') { - continue; + char *comment = strchr(buf, '#'); + if (comment) { + *comment = '\0'; } + char *line = trimwhitespace(buf); if (strlen(line) == 0) { continue; }