[Lxc-users] [PATCH] ignore non-lxc configuration line

Daniel Lezcano dlezcano at fr.ibm.com
Fri May 13 20:32:06 UTC 2011


From: Daniel Lezcano <daniel.lezcano at free.fr>

We ignore the line of in the configuration file not beginning by "lxc."
So we can mix the configuration file with another information used for
another component through the lxc library.

Signed-off-by: Daniel Lezcano <dlezcano at fr.ibm.com>
---
 src/lxc/confile.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 791f04f..d632404 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -799,7 +799,7 @@ static int parse_line(char *buffer, void *data)
 	char *dot;
 	char *key;
 	char *value;
-	int ret = -1;
+	int ret = 0;
 
 	if (lxc_is_line_empty(buffer))
 		return 0;
@@ -815,10 +815,14 @@ static int parse_line(char *buffer, void *data)
 	}
 
 	line += lxc_char_left_gc(line, strlen(line));
-	if (line[0] == '#') {
-		ret = 0;
+
+	/* martian option - ignoring it, the commented lines beginning by '#'
+	 * fall in this case
+	 */
+	if (strncmp(line, "lxc.", 4))
 		goto out;
-	}
+
+	ret = -1;
 
 	dot = strstr(line, "=");
 	if (!dot) {
-- 
1.7.1





More information about the lxc-users mailing list