]> git.proxmox.com Git - mirror_lxc.git/commitdiff
don't fail lxc-init if we couldn't mount proc
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 22 Nov 2013 21:43:51 +0000 (15:43 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 22 Nov 2013 21:52:57 +0000 (15:52 -0600)
In general proc gets mounted ahead of time, so init shouldn't
have to do it.  Without this patch, you cannot

lxc-execute -n x1 -s lxc.cap.drop=sys_admin /bin/bash

(See https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1253669 for
a bug about this)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxc_init.c
src/lxc/utils.c
src/lxc/utils.h

index 69ae3d8f417c67db92846745419cde1f55725c56..968c25d6c25a4240c8374b511d49999429a39061 100644 (file)
@@ -154,8 +154,7 @@ int main(int argc, char *argv[])
                sigaction(i, &act, NULL);
        }
 
-       if (lxc_setup_fs())
-               exit(EXIT_FAILURE);
+       lxc_setup_fs();
 
        if (lxc_caps_reset())
                exit(EXIT_FAILURE);
index e80a7826d073610c31715e5335696791698d55ad..5bfe9dba2b4958b02269760b27d5010831c080af 100644 (file)
@@ -150,10 +150,10 @@ static int mount_fs(const char *source, const char *target, const char *type)
        return 0;
 }
 
-extern int lxc_setup_fs(void)
+extern void lxc_setup_fs(void)
 {
        if (mount_fs("proc", "/proc", "proc"))
-               return -1;
+               INFO("failed to remount proc");
 
        /* if we can't mount /dev/shm, continue anyway */
        if (mount_fs("shmfs", "/dev/shm", "tmpfs"))
@@ -163,14 +163,12 @@ extern int lxc_setup_fs(void)
        /* Sure, but it's read-only per config :) */
        if (access("/dev/mqueue", F_OK) && mkdir("/dev/mqueue", 0666)) {
                DEBUG("failed to create '/dev/mqueue'");
-               return 0;
+               return;
        }
 
        /* continue even without posix message queue support */
        if (mount_fs("mqueue", "/dev/mqueue", "mqueue"))
                INFO("failed to mount /dev/mqueue");
-
-       return 0;
 }
 
 /* borrowed from iproute2 */
index 9c47560cf20f0891cd65a77158ef25777562bf54..714e74c6fb0810540188dfce54d2b7b1df88e987 100644 (file)
@@ -34,7 +34,7 @@
 
 /* returns 1 on success, 0 if there were any failures */
 extern int lxc_rmdir_onedev(char *path);
-extern int lxc_setup_fs(void);
+extern void lxc_setup_fs(void);
 extern int get_u16(unsigned short *val, const char *arg, int base);
 extern int mkdir_p(const char *dir, mode_t mode);
 extern void remove_trailing_slashes(char *p);