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

KATOH Yasufumi karma at jazz.email.ne.jp
Thu Aug 28 08:38:00 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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 5de1241..8aab5d0 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,11 @@ static int parse_line(char *buffer, void *data)
 	*dot = '\0';
 	value = dot + 1;
 
+	comment = strstr(value, "#");
+	if (comment) {
+		*comment = '\0';
+	}
+
 	key = line;
 	key[lxc_char_right_gc(key, strlen(key))] = '\0';
 
-- 
2.0.4



More information about the lxc-devel mailing list