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

TAMUKI Shoichi tamuki at linet.gr.jp
Thu Aug 28 13:11:42 UTC 2014


Hello KATOH-san,

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

> @@ -1743,6 +1744,9 @@ static int parse_line(char *buffer, void *data)
>  	*dot = '\0';
>  	value = dot + 1;
>  
> +	comment = strstr(value, "#");
> +	*comment = '\0';
> +
>  	key = line;
>  	key[lxc_char_right_gc(key, strlen(key))] = '\0';
 
This will not do.  If "#" is not found, strstr() returns NULL. :-(

I just intended to point out like this:

	if (comment = strstr(value, "#"))
		*comment = '\0';

By the way, do you mean a hash mark ("#") can be anywhere on a line?

lxc.utsname = ct01 # the rest of the line will be treated as a comment.

If so, that requires careful consideration for the following case.

lxc.rootfs = /mnt/rootfs.test#01

I think that a hash mark ("#") as a comment must be at the beginning
of a line.

Regards,
TAMUKI Shoichi


More information about the lxc-devel mailing list