Skip to content

Commit

Permalink
Only mount /proc if needed, even without a rootfs
Browse files Browse the repository at this point in the history
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@ll.mit.edu>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
dpward authored and stgraber committed Aug 27, 2015
1 parent f9945dd commit 459b871
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/lxc/conf.c
Expand Up @@ -3994,17 +3994,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;
}
Expand Down

0 comments on commit 459b871

Please sign in to comment.