From: Christian Brauner Date: Fri, 14 Aug 2015 18:17:21 +0000 (+0200) Subject: Make LXC_CLONE_KEEPNAME work X-Git-Tag: lxc-1.0.8~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e8d33d06661ebded11874976c0fa747d9b6f07e;p=thirdparty%2Flxc.git Make LXC_CLONE_KEEPNAME work - Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected and let to unexpected behaviour for e.g. lxc-clone. We wrap clear_unexp_config_line() and set_config_item_line() in an appropriate if-condition. Signed-off-by: Christian Brauner Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 92523116d..49f3887e1 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -2693,9 +2693,11 @@ static struct lxc_container *lxcapi_clone(struct lxc_container *c, const char *n goto out; // update utsname - if (!set_config_item_locked(c2, "lxc.utsname", newname)) { - ERROR("Error setting new hostname"); - goto out; + if (!(flags & LXC_CLONE_KEEPNAME)) { + if (!set_config_item_locked(c2, "lxc.utsname", newname)) { + ERROR("Error setting new hostname"); + goto out; + } } // copy hooks