mirror of
git://github.com/lxc/lxc
synced 2025-09-02 19:59:34 +00:00
Merge pull request #701 from hallyn/fixunexp
lxcapi_clone: restore the unexpanded config len
This commit is contained in:
@@ -3059,6 +3059,7 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
|
|||||||
int ret, storage_copied = 0;
|
int ret, storage_copied = 0;
|
||||||
char *origroot = NULL, *saved_unexp_conf = NULL;
|
char *origroot = NULL, *saved_unexp_conf = NULL;
|
||||||
struct clone_update_data data;
|
struct clone_update_data data;
|
||||||
|
size_t saved_unexp_len;
|
||||||
FILE *fout;
|
FILE *fout;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
@@ -3106,6 +3107,7 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
saved_unexp_conf = c->lxc_conf->unexpanded_config;
|
saved_unexp_conf = c->lxc_conf->unexpanded_config;
|
||||||
|
saved_unexp_len = c->lxc_conf->unexpanded_len;
|
||||||
c->lxc_conf->unexpanded_config = strdup(saved_unexp_conf);
|
c->lxc_conf->unexpanded_config = strdup(saved_unexp_conf);
|
||||||
if (!c->lxc_conf->unexpanded_config) {
|
if (!c->lxc_conf->unexpanded_config) {
|
||||||
ERROR("Out of memory");
|
ERROR("Out of memory");
|
||||||
@@ -3118,6 +3120,7 @@ static struct lxc_container *do_lxcapi_clone(struct lxc_container *c, const char
|
|||||||
free(c->lxc_conf->unexpanded_config);
|
free(c->lxc_conf->unexpanded_config);
|
||||||
c->lxc_conf->unexpanded_config = saved_unexp_conf;
|
c->lxc_conf->unexpanded_config = saved_unexp_conf;
|
||||||
saved_unexp_conf = NULL;
|
saved_unexp_conf = NULL;
|
||||||
|
c->lxc_conf->unexpanded_len = saved_unexp_len;
|
||||||
|
|
||||||
sprintf(newpath, "%s/%s/rootfs", lxcpath, newname);
|
sprintf(newpath, "%s/%s/rootfs", lxcpath, newname);
|
||||||
if (mkdir(newpath, 0755) < 0) {
|
if (mkdir(newpath, 0755) < 0) {
|
||||||
|
Reference in New Issue
Block a user