mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-29 13:41:36 +00:00
execute: set init_path when existing init is found
I'm not really sure we should be looking in the rootfs for an existing init, but I'll send a much more invasive patch to correct that. For now, let's just make sure we set init_path when we find one, so that later in execute_start() we don't bail. Signed-off-by: Tycho Andersen <tycho@tycho.ws>
This commit is contained in:
parent
9c40b2d978
commit
410898489f
@ -3213,8 +3213,15 @@ static int lxc_execute_bind_init(struct lxc_handler *handler)
|
|||||||
/* If init exists in the container, don't bind mount a static one */
|
/* If init exists in the container, don't bind mount a static one */
|
||||||
p = choose_init(conf->rootfs.mount);
|
p = choose_init(conf->rootfs.mount);
|
||||||
if (p) {
|
if (p) {
|
||||||
free(p);
|
char *old = p;
|
||||||
return 0;
|
|
||||||
|
p = strdup(old + strlen(conf->rootfs.mount));
|
||||||
|
free(old);
|
||||||
|
if (!p)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
INFO("Found existing init at \"%s\"", p);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snprintf(path, PATH_MAX, SBINDIR "/init.lxc.static");
|
ret = snprintf(path, PATH_MAX, SBINDIR "/init.lxc.static");
|
||||||
@ -3247,9 +3254,10 @@ static int lxc_execute_bind_init(struct lxc_handler *handler)
|
|||||||
p = strdup(destpath + strlen(conf->rootfs.mount));
|
p = strdup(destpath + strlen(conf->rootfs.mount));
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
((struct execute_args *)handler->data)->init_path = p;
|
|
||||||
|
|
||||||
INFO("Bind mounted lxc.init.static into container at \"%s\"", path);
|
INFO("Bind mounted lxc.init.static into container at \"%s\"", path);
|
||||||
|
out:
|
||||||
|
((struct execute_args *)handler->data)->init_path = p;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user