[lxc-devel] [PATCH] Parse: add error info when parse config failed

Qiang Huang h.huangqiang at huawei.com
Mon Sep 16 02:04:59 UTC 2013


When callback of one config line fail, we'd better give the exactly
info to help users locate the misconfig.

Signed-off-by: Qiang Huang <h.huangqiang at huawei.com>
---
 src/lxc/parse.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lxc/parse.c b/src/lxc/parse.c
index 26cbbdd..dca808d 100644
--- a/src/lxc/parse.c
+++ b/src/lxc/parse.c
@@ -98,8 +98,10 @@ int lxc_file_for_each_line(const char *file, lxc_file_cb callback, void *data)

 	while (getline(&line, &len, f) != -1) {
 		err = callback(line, data);
-		if (err)
+		if (err) {
+			ERROR("Failed to parse config: %s", line);
 			break;
+		}
 	}

 	if (line)
-- 
1.8.3





More information about the lxc-devel mailing list