[lxc-devel] [PATCH 2/3] Fix mode when creating temporary directory

Christian Brauner christian.brauner at mailbox.org
Mon Nov 9 20:47:28 UTC 2015


From: Christian Brauner <christianvanbrauner at gmail.com>

When we create a random container directory with mkdtemp() we set the mode to
0770 otherwise do_lxcapi_clone() will complain about not being able to create
the config.

Signed-off-by: Christian Brauner <christianvanbrauner at gmail.com>
---
 src/lxc/lxc_copy.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/lxc/lxc_copy.c b/src/lxc/lxc_copy.c
index 1a2d007..e5f52d2 100644
--- a/src/lxc/lxc_copy.c
+++ b/src/lxc/lxc_copy.c
@@ -382,6 +382,8 @@ static int do_clone_ephemeral(struct lxc_container *c,
 			return -1;
 		if (!mkdtemp(randname))
 			return -1;
+		if (chmod(randname, 0770) < 0)
+			return -1;
 		my_args->newname = randname + strlen(my_args->newpath) + 1;
 	}
 
-- 
2.6.2



More information about the lxc-devel mailing list