From: Bogdan Purcareata Date: Fri, 8 Jan 2016 15:38:44 +0000 (+0000) Subject: lxc_setup_fs: Create /dev/shm folder if it doesn't exist X-Git-Tag: lxc-1.0.9~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88ba5941379aee6aab7794bff44037c1667c7460;p=thirdparty%2Flxc.git lxc_setup_fs: Create /dev/shm folder if it doesn't exist When running application containers with lxc-execute, /dev is populated only with device entries. Since /dev is a tmpfs mount in the container environment, the /dev/shm folder not being present is not a sufficient reason for the /dev/shm mount to fail. Create the /dev/shm directory if not present. Signed-off-by: Bogdan Purcareata Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/initutils.c b/src/lxc/initutils.c index dbb5d52f5..26194ca08 100644 --- a/src/lxc/initutils.c +++ b/src/lxc/initutils.c @@ -47,6 +47,10 @@ extern void lxc_setup_fs(void) if (mount_fs("proc", "/proc", "proc")) INFO("failed to remount proc"); + /* if /dev has been populated by us, /dev/shm does not exist */ + if (access("/dev/shm", F_OK) && mkdir("/dev/shm", 0777)) + INFO("failed to create /dev/shm"); + /* if we can't mount /dev/shm, continue anyway */ if (mount_fs("shmfs", "/dev/shm", "tmpfs")) INFO("failed to mount /dev/shm");