From: Daniel Lezcano Date: Wed, 24 Feb 2010 09:57:43 +0000 (+0100) Subject: fix no rootfs no console X-Git-Tag: lxc-0.7.0~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1560f6c9a7c822fd625914eefa0b985f67d76a0a;p=thirdparty%2Flxc.git fix no rootfs no console When there is no rootfs, don't create a console. Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/console.c b/src/lxc/console.c index c14a38bc0..c2bc29bb4 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -139,9 +139,13 @@ out_close: return 1; } -int lxc_create_console(struct lxc_console *console) +int lxc_create_console(struct lxc_conf *conf) { struct termios tios; + struct lxc_console *console = &conf->console; + + if (!conf->rootfs) + return 0; if (openpty(&console->master, &console->slave, console->name, NULL, NULL)) { @@ -239,6 +243,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr, struct lxc_conf *conf = handler->conf; struct lxc_console *console = &conf->console; + if (!conf->rootfs) { + INFO("no rootfs, no console."); + return 0; + } + if (lxc_mainloop_add_handler(descr, console->master, console_handler, console)) { ERROR("failed to add to mainloop console handler for '%d'", diff --git a/src/lxc/console.h b/src/lxc/console.h index b465cc72e..5b47df373 100644 --- a/src/lxc/console.h +++ b/src/lxc/console.h @@ -21,6 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -extern int lxc_create_console(struct lxc_console *); +extern int lxc_create_console(struct lxc_conf *); extern void lxc_delete_console(struct lxc_console *); extern int lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_handler *); diff --git a/src/lxc/start.c b/src/lxc/start.c index f4293f73b..4b75577fd 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -207,7 +207,7 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf) goto out_aborting; } - if (lxc_create_console(&conf->console)) { + if (lxc_create_console(conf)) { ERROR("failed to create console"); goto out_delete_tty; }