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

TAMUKI Shoichi tamuki at linet.gr.jp
Thu Aug 28 10:17:53 UTC 2014


Hello KATOH-san,

From: KATOH Yasufumi <karma at jazz.email.ne.jp>
Subject: [lxc-devel] [PATCH] Remove a comment part from a config value
Date: Thu, 28 Aug 2014 17:38:00 +0900

> 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>

Reviewed-by: TAMUKI Shoichi <tamuki at linet.gr.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;

You should use tab, not spaces.

>  	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';
> +	}

I think the braces are unneeded here.

> +
>  	key = line;
>  	key[lxc_char_right_gc(key, strlen(key))] = '\0';
>  
> -- 
> 2.0.4

Regards,
TAMUKI Shoichi


More information about the lxc-devel mailing list