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'",