From f78a1f32f41f6acbbf0b78e6498736dbd22e2301 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 2 Apr 2010 23:37:42 +0200 Subject: [PATCH] fix when console is not specified When no console is specified, do not try to setup the console. Signed-off-by: Daniel Lezcano --- src/lxc/conf.c | 4 +++- src/lxc/console.c | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 7486fdf0a..3242f17b6 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -676,8 +676,10 @@ static int setup_console(const char *rootfs, const struct lxc_console *console) return 0; } - if (console->peer == -1) + if (console->peer == -1) { INFO("no console output required"); + return 0; + } if (stat(path, &s)) { SYSERROR("failed to stat '%s'", path); diff --git a/src/lxc/console.c b/src/lxc/console.c index 16c5b590c..f40fb0be2 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -148,6 +148,9 @@ int lxc_create_console(struct lxc_conf *conf) if (!conf->rootfs) return 0; + if (!console->path) + return 0; + if (openpty(&console->master, &console->slave, console->name, NULL, NULL)) { SYSERROR("failed to allocate a pty"); @@ -257,6 +260,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr, return 0; } + if (!console->path) { + INFO("no console specified"); + return 0; + } + if (lxc_mainloop_add_handler(descr, console->master, console_handler, console)) { ERROR("failed to add to mainloop console handler for '%d'",