]> git.ipfire.org Git - thirdparty/lxc.git/commit
Make mount_entry_create_*_dirs() more robust
authorChristian Brauner <christianvanbrauner@gmail.com>
Wed, 7 Oct 2015 17:34:02 +0000 (19:34 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 6 Nov 2015 22:32:59 +0000 (17:32 -0500)
commit0e86d94a056bdd082212522a2d43b66ea6d4c7e7
tree5813128b1364d86d4737ae2d35566838ba5a6432
parent827cc83a63fbec52928bc650fc13e62b2480feb6
Make mount_entry_create_*_dirs() more robust

The mount_entry_create_*_dirs() functions currently assume that the rootfs of
the container is actually named "rootfs". This has the consequence that

del = strstr(lxcpath, "/rootfs");
if (!del) {
free(lxcpath);
lxc_free_array((void **)opts, free);
return -1;
}
*del = '\0';

will return NULL when the rootfs of a container is not actually named "rootfs".
This means the we return -1 and do not create the necessary upperdir/workdir
directories required for the overlay/aufs mount to work. Hence, let's not make
that assumption. We now pass lxc_path and lxc_name to
mount_entry_create_*_dirs() and create the path directly. To prevent failure we
also have mount_entry_create_*_dirs() check that lxc_name and lxc_path are not
empty when they are passed in.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/conf.c