From: David Ward Date: Tue, 23 Jun 2015 14:57:19 +0000 (-0400) Subject: Only mount /proc if needed, even without a rootfs X-Git-Tag: lxc-2.0.0.beta1~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01958b1fe09ce635d4cb404878af599839a818d6;p=thirdparty%2Flxc.git Only mount /proc if needed, even without a rootfs 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 Acked-by: Serge E. Hallyn --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index aa0edd507..d02dc8382 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -3496,17 +3496,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 = mount_proc_if_needed(lxc_conf->rootfs.mount); + mounted = mount_proc_if_needed(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; }