[lxc-devel] [PATCH stable-1.1 1/7] Only mount /proc if needed, even without a rootfs
David Ward
david.ward at ll.mit.edu
Tue Jun 23 14:57:26 UTC 2015
Use the same code with and without a rootfs to check if mounting
/proc is necessary before doing so. If mounting it is unsuccessful
and there is no rootfs, continue as before.
Signed-off-by: David Ward <david.ward at ll.mit.edu>
---
src/lxc/conf.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index f9c7e37..6a55b39 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -3579,17 +3579,12 @@ int tmp_proc_mount(struct lxc_conf *lxc_conf)
{
int mounted;
- if (lxc_conf->rootfs.path == NULL || strlen(lxc_conf->rootfs.path) == 0) {
- if (mount("proc", "/proc", "proc", 0, NULL)) {
- SYSERROR("Failed mounting /proc, proceeding");
- mounted = 0;
- } else
- mounted = 1;
- } else
- mounted = do_tmp_proc_mount(lxc_conf->rootfs.mount);
+ mounted = do_tmp_proc_mount(lxc_conf->rootfs.path ? lxc_conf->rootfs.mount : "");
if (mounted == -1) {
SYSERROR("failed to mount /proc in the container.");
- return -1;
+ /* continue only if there is no rootfs */
+ if (lxc_conf->rootfs.path)
+ return -1;
} else if (mounted == 1) {
lxc_conf->tmp_umount_proc = 1;
}
--
1.7.1
More information about the lxc-devel
mailing list