Quoting S.Çağlar Onur ([email protected]):
> Signed-off-by: S.Çağlar Onur <[email protected]>
You're missing the part where copyhooks only copies hooks under the
container's path. Could be as simple as the following untested patch:
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 1af8d62..9ee29fd 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -2187,7 +2187,13 @@ static int copyhooks(struct lxc_container *oldc, struct
lxc_container *c)
int i;
int ret;
struct lxc_list *it;
+ char *cpath;
+ i = strlen(oldc->config_path) + strlen(oldc->name) + 3;
+ cpath = alloca(i);
+ ret = snprintf(cpath, i, "%s/%s/", oldc->config_path, oldc->name);
+ if (ret < 0 || ret >= i)
+ return -1;
for (i=0; i<NUM_LXC_HOOKS; i++) {
lxc_list_for_each(it, &c->lxc_conf->hooks[i]) {
char *hookname = it->elem;
@@ -2195,6 +2201,10 @@ static int copyhooks(struct lxc_container *oldc, struct
lxc_container *c)
char tmppath[MAXPATHLEN];
if (!fname) // relative path - we don't support, but
maybe we should
return 0;
+ if (strncpy(hookname, cpath) != 0) {
+ // this hook is public - ignore
+ continue;
+ }
// copy the script, and change the entry in confile
ret = snprintf(tmppath, MAXPATHLEN, "%s/%s/%s",
c->config_path, c->name, fname+1);
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel