[lxc-devel] [PATCH 1/1] lxcapi_snapshot: check that c is defined

Stéphane Graber stgraber at ubuntu.com
Tue Jun 3 19:03:59 UTC 2014


On Tue, Jun 03, 2014 at 01:16:03PM -0500, Serge Hallyn wrote:
> before using it, like the other snapshot api methods do.
> 
> This will need to go into stable-1.0 as well.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

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

> ---
>  src/lxc/lxccontainer.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index ac6de62..5cedb27 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -2852,6 +2852,9 @@ static int lxcapi_snapshot(struct lxc_container *c, const char *commentfile)
>  	struct lxc_container *c2;
>  	char snappath[MAXPATHLEN], newname[20];
>  
> +	if (!c || !lxcapi_is_defined(c))
> +		return -1;
> +
>  	// /var/lib/lxc -> /var/lib/lxcsnaps \0
>  	ret = snprintf(snappath, MAXPATHLEN, "%ssnaps/%s", c->config_path, c->name);
>  	if (ret < 0 || ret >= MAXPATHLEN)
> -- 
> 2.0.0
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
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: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140603/c61010a3/attachment.sig>


More information about the lxc-devel mailing list