[lxc-devel] [PATCH] clear_config_item should only work for lists

Stéphane Graber stgraber at ubuntu.com
Mon Jan 26 22:56:11 UTC 2015


On Mon, Jan 26, 2015 at 10:52:36PM +0000, Serge Hallyn wrote:
> Quoting Stéphane Graber (stgraber at ubuntu.com):
> > Close #394
> > 
> > Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
> 
> Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

Note that this exposed a slight problem with clearing values through
set_config_item for network keys. We won't be pushing that fix in rc3
but it will make it in final.

> 
> > ---
> >  src/lxc/conf.c    | 21 ---------------------
> >  src/lxc/confile.c | 10 ++--------
> >  2 files changed, 2 insertions(+), 29 deletions(-)
> > 
> > diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> > index c7db06f..2f22eaf 100644
> > --- a/src/lxc/conf.c
> > +++ b/src/lxc/conf.c
> > @@ -3953,27 +3953,6 @@ int lxc_clear_nic(struct lxc_conf *c, const char *key)
> >  			free(it2->elem);
> >  			free(it2);
> >  		}
> > -	} else if (strcmp(p1, ".link") == 0) {
> > -		free(netdev->link);
> > -		netdev->link = NULL;
> > -	} else if (strcmp(p1, ".name") == 0) {
> > -		free(netdev->name);
> > -		netdev->name = NULL;
> > -	} else if (strcmp(p1, ".script.up") == 0) {
> > -		free(netdev->upscript);
> > -		netdev->upscript = NULL;
> > -	} else if (strcmp(p1, ".hwaddr") == 0) {
> > -		free(netdev->hwaddr);
> > -		netdev->hwaddr = NULL;
> > -	} else if (strcmp(p1, ".mtu") == 0) {
> > -		free(netdev->mtu);
> > -		netdev->mtu = NULL;
> > -	} else if (strcmp(p1, ".ipv4.gateway") == 0) {
> > -		free(netdev->ipv4_gateway);
> > -		netdev->ipv4_gateway = NULL;
> > -	} else if (strcmp(p1, ".ipv6.gateway") == 0) {
> > -		free(netdev->ipv6_gateway);
> > -		netdev->ipv6_gateway = NULL;
> >  	}
> >  		else return -1;
> >  
> > diff --git a/src/lxc/confile.c b/src/lxc/confile.c
> > index a2e964b..be81f5d 100644
> > --- a/src/lxc/confile.c
> > +++ b/src/lxc/confile.c
> > @@ -2442,16 +2442,10 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
> >  		return lxc_clear_hooks(c, key);
> >  	else if (strncmp(key, "lxc.group", 9) == 0)
> >  		return lxc_clear_groups(c);
> > -	else if (strncmp(key, "lxc.seccomp", 11) == 0) {
> > -		lxc_seccomp_free(c);
> > -		return 0;
> > -	}
> > -	else if (strncmp(key, "lxc.environment", 15) == 0) {
> > +	else if (strncmp(key, "lxc.environment", 15) == 0)
> >  		return lxc_clear_environment(c);
> > -	}
> > -	else if (strncmp(key, "lxc.id_map", 10) == 0) {
> > +	else if (strncmp(key, "lxc.id_map", 10) == 0)
> >  		return lxc_clear_idmaps(c);
> > -	}
> >  	return -1;
> >  }
> >  
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> _______________________________________________
> 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/20150126/1c20b182/attachment.sig>


More information about the lxc-devel mailing list