Commit eab218fb by Christian Brauner

Make LXC_CLONE_KEEPNAME work

Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected. We wrap clear_unexp_config_line() and set_config_item_line() in an appropriate if-condition. Signed-off-by: 's avatarChristian Brauner <christianvanbrauner@gmail.com>
parent 840d2afe
...@@ -2906,13 +2906,16 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char ...@@ -2906,13 +2906,16 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
if (ret < 0) if (ret < 0)
goto out; goto out;
clear_unexp_config_line(c2->lxc_conf, "lxc.utsname", false);
// update utsname // update utsname
if (!(flags & LXC_CLONE_KEEPNAME)) {
clear_unexp_config_line(c2->lxc_conf, "lxc.utsname", false);
if (!set_config_item_locked(c2, "lxc.utsname", newname)) { if (!set_config_item_locked(c2, "lxc.utsname", newname)) {
ERROR("Error setting new hostname"); ERROR("Error setting new hostname");
goto out; goto out;
} }
}
// copy hooks // copy hooks
ret = copyhooks(c, c2); ret = copyhooks(c, c2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment