[lxc-devel] [PATCH v2] Remove a comment part from a config value

KATOH Yasufumi karma at jazz.email.ne.jp
Thu Aug 28 10:51:06 UTC 2014


When a config line has a comment part, currently the comment part is
included in the value. This patch remove the comment from the value.

Signed-off-by: KATOH Yasufumi <karma at jazz.email.ne.jp>
---
 src/lxc/confile.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 5de1241..ec5023c 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -1700,6 +1700,7 @@ static int parse_line(char *buffer, void *data)
 	struct lxc_config_t *config;
 	char *line, *linep;
 	char *dot;
+	char *comment;
 	char *key;
 	char *value;
 	int ret = 0;
@@ -1743,6 +1744,9 @@ static int parse_line(char *buffer, void *data)
 	*dot = '\0';
 	value = dot + 1;
 
+	comment = strstr(value, "#");
+	*comment = '\0';
+
 	key = line;
 	key[lxc_char_right_gc(key, strlen(key))] = '\0';
 
-- 
2.0.4



More information about the lxc-devel mailing list