diff options
author | Daniel Lezcano <daniel.lezcano@free.fr> | 2011-08-09 16:51:01 +0200 |
---|---|---|
committer | Daniel Lezcano <dlezcano@fr.ibm.com> | 2011-08-09 16:51:01 +0200 |
commit | dff21ef019d001a25adcaa947d67942b61bbab22 (patch) | |
tree | dc3499bc7ecfec16c5f9e1373571035e75e781f5 | |
parent | Use container's /run/utmp if it exists (diff) | |
download | lxc-dff21ef019d001a25adcaa947d67942b61bbab22.tar.gz lxc-dff21ef019d001a25adcaa947d67942b61bbab22.tar.bz2 lxc-dff21ef019d001a25adcaa947d67942b61bbab22.zip |
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 <dlezcano@fr.ibm.com>
-rw-r--r-- | doc/lxc.conf.sgml.in | 5 | ||||
-rw-r--r-- | src/lxc/console.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/doc/lxc.conf.sgml.in b/doc/lxc.conf.sgml.in index c4cb327..cfaa686 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 <listitem> <para> 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. </para> </listitem> </varlistentry> diff --git a/src/lxc/console.c b/src/lxc/console.c index b5fc270..73bec78 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'", |