From: Daniel Lezcano Date: Fri, 2 Apr 2010 21:37:42 +0000 (+0200) Subject: fix when console is not specified X-Git-Tag: lxc-0.7.0~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f78a1f32f41f6acbbf0b78e6498736dbd22e2301;p=thirdparty%2Flxc.git fix when console is not specified When no console is specified, do not try to setup the console. Signed-off-by: Daniel Lezcano --- 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'",