diff options
author | dlezcano <dlezcano> | 2008-12-09 17:38:18 +0000 |
---|---|---|
committer | dlezcano <dlezcano> | 2008-12-09 17:38:18 +0000 |
commit | ed502555f4e8fd634f9977b6b8310bb70c27361e (patch) | |
tree | 4d2d371d66beb5757e0ef28afb6aa013d32e89ad | |
parent | Allow to use /dev/ptmx (diff) | |
download | lxc-ed502555f4e8fd634f9977b6b8310bb70c27361e.tar.gz lxc-ed502555f4e8fd634f9977b6b8310bb70c27361e.tar.bz2 lxc-ed502555f4e8fd634f9977b6b8310bb70c27361e.zip |
Change access mount and check on the console
From: Daniel Lezcano <dlezcano@fr.ibm.com>
Changed to access the console to the rootfs directly.
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r-- | src/lxc/lxc_conf.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index a6219ff..ab35860 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -668,10 +668,14 @@ static int setup_rootfs(const char *name) static int setup_console(const char *name, const char *tty) { - if (access("/dev/console", R_OK|W_OK)) + char console[MAXPATHLEN]; + + snprintf(console, MAXPATHLEN, LXCPATH "/%s/rootfs/dev/console", name); + + if (access(console, R_OK|W_OK)) return 0; - if (mount(tty, "/dev/console", "none", MS_BIND, 0)) { + if (mount(tty, console, "none", MS_BIND, 0)) { lxc_log_error("failed to mount the console"); return -1; } @@ -1411,15 +1415,15 @@ int lxc_setup(const char *name, const char *tty) return -LXC_ERROR_SETUP_MOUNT; } - if (conf_has_rootfs(name) && setup_rootfs(name)) { - lxc_log_error("failed to set rootfs for '%s'", name); - return -LXC_ERROR_SETUP_ROOTFS; - } - if (tty[0] && setup_console(name, tty)) { lxc_log_error("failed to setup the console for '%s'", name); return -LXC_ERROR_SETUP_CONSOLE; } + if (conf_has_rootfs(name) && setup_rootfs(name)) { + lxc_log_error("failed to set rootfs for '%s'", name); + return -LXC_ERROR_SETUP_ROOTFS; + } + return 0; } |