From: Daniel Lezcano Date: Tue, 9 Aug 2011 14:51:01 +0000 (+0200) Subject: explicitly do not use the console X-Git-Tag: lxc-0.7.5~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dff21ef019d001a25adcaa947d67942b61bbab22;p=thirdparty%2Flxc.git explicitly do not use the console If the keyword 'none' is specified for the console name, lxc will ignore creating a console. That allows to have a rootfs but without a console. Signed-off-by: Daniel Lezcano --- diff --git a/doc/lxc.conf.sgml.in b/doc/lxc.conf.sgml.in index c4cb3272a..cfaa68699 100644 --- a/doc/lxc.conf.sgml.in +++ b/doc/lxc.conf.sgml.in @@ -372,7 +372,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Specify a path to a file where the console output will - be written. + be written. The keyword 'none' will simply disable the + console. This is dangerous once if have a rootfs with a + console device file where the application can write, the + messages will fall in the host. diff --git a/src/lxc/console.c b/src/lxc/console.c index b5fc270a9..73bec7833 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -176,6 +176,9 @@ int lxc_create_console(struct lxc_conf *conf) return -1; } + if (!strcmp(console->path, "none")) + return 0; + if (openpty(&console->master, &console->slave, console->name, NULL, NULL)) { SYSERROR("failed to allocate a pty"); @@ -300,6 +303,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr, return 0; } + if (console->peer == -1) { + INFO("no console will be used"); + return 0; + } + if (lxc_mainloop_add_handler(descr, console->master, console_handler, console)) { ERROR("failed to add to mainloop console handler for '%d'",