From 79cf945c063bbddc0c39a8370d2ff3507180db99 Mon Sep 17 00:00:00 2001 From: dlezcano Date: Wed, 28 Jan 2009 16:33:55 +0000 Subject: [PATCH] From: Daniel Lezcano This modification removes the tty configuration file and makes the tty to be usable with the local tty. Signed-off-by: Daniel Lezcano Signed-off-by: Daniel Lezcano --- src/lxc/lxc_conf.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index 826cc96c1..086e5410c 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -625,6 +625,16 @@ static int unconfigure_rootfs(const char *name) return 0; } +static int unconfigure_tty(const char *name) +{ + char path[MAXPATHLEN]; + + snprintf(path, MAXPATHLEN, LXCPATH "/%s", name); + delete_info(path, "tty"); + + return 0; +} + static int unconfigure_mount(const char *name) { char path[MAXPATHLEN]; @@ -678,7 +688,11 @@ static int setup_tty(const char *name, const struct lxc_tty_info *tty_info) struct lxc_pty_info *pty_info = &tty_info->pty_info[i]; - snprintf(path, MAXPATHLEN, LXCPATH "/%s/rootfs/dev/tty%d", name, i + 1); + if (conf_has_rootfs(name)) + snprintf(path, MAXPATHLEN, + LXCPATH "/%s/rootfs/dev/tty%d", name, i + 1); + else + snprintf(path, MAXPATHLEN, "/dev/tty%d", i + 1); /* At this point I can not use the "access" function * to check the file is present or not because it fails @@ -1143,6 +1157,9 @@ int lxc_unconfigure(const char *name) if (conf_has_cgroup(name) && unconfigure_cgroup(name)) lxc_log_error("failed to cleanup cgroup"); + if (conf_has_tty(name) && unconfigure_tty(name)) + lxc_log_error("failed to cleanup mount"); + if (conf_has_rootfs(name) && unconfigure_rootfs(name)) lxc_log_error("failed to cleanup rootfs"); @@ -1456,11 +1473,12 @@ int lxc_create_tty(const char *name, struct lxc_tty_info *tty_info) if (!conf_has_tty(name)) return 0; +/* if (!conf_has_rootfs(name)) { lxc_log_warning("no rootfs is configured, ignoring ttys"); return 0; } - +*/ snprintf(path, MAXPATHLEN, LXCPATH "/%s", name); if (read_info(path, "tty", tty, sizeof(tty)) < 0) { -- 2.39.5