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

Qiang Huang h.huangqiang at huawei.com
Mon Sep 23 11:21:48 UTC 2013


ping.

Hi Serge or Stéphane,

What do you think about this patch?
Spell error happens in our config file(many times for me :( ), and
this error info will really save user's time to figure out the
problem.

On 2013/9/16 10:04, Qiang Huang wrote:
> 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)
> 






More information about the lxc-devel mailing list