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

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


Close #394

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 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



More information about the lxc-devel mailing list