[lxc-devel] [PATCH] quiet gcc 4.4.7 warning about saveptr use before initialization

Stéphane Graber stgraber at ubuntu.com
Tue Apr 16 16:14:12 UTC 2013


On 04/16/2013 05:47 PM, Dwight Engen wrote:
> The recent change to use strtok_r causes a build warning with this older
> gcc version, so initialize saveptr to NULL to quiet the compiler and
> unbreak the build. There was no warning with gcc 4.7.2 that I
> originally tested with.
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Ah good, I was actually about to propose the same fix as coverity
detected it as an error.

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/conf.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index cf97eef..f895050 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -759,7 +759,7 @@ static int setup_tty(const struct lxc_rootfs *rootfs,
>  static int setup_rootfs_pivot_root_cb(char *buffer, void *data)
>  {
>  	struct lxc_list	*mountlist, *listentry, *iterator;
> -	char *pivotdir, *mountpoint, *mountentry, *saveptr;
> +	char *pivotdir, *mountpoint, *mountentry, *saveptr = NULL;
>  	int found;
>  	void **cbparm;
>  
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130416/bdfc6376/attachment.pgp>


More information about the lxc-devel mailing list