Commit dff21ef0 by Daniel Lezcano Committed by Daniel Lezcano

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: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 4cb05a60
...@@ -372,7 +372,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ...@@ -372,7 +372,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<listitem> <listitem>
<para> <para>
Specify a path to a file where the console output will 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> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
...@@ -176,6 +176,9 @@ int lxc_create_console(struct lxc_conf *conf) ...@@ -176,6 +176,9 @@ int lxc_create_console(struct lxc_conf *conf)
return -1; return -1;
} }
if (!strcmp(console->path, "none"))
return 0;
if (openpty(&console->master, &console->slave, if (openpty(&console->master, &console->slave,
console->name, NULL, NULL)) { console->name, NULL, NULL)) {
SYSERROR("failed to allocate a pty"); SYSERROR("failed to allocate a pty");
...@@ -300,6 +303,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr, ...@@ -300,6 +303,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr,
return 0; return 0;
} }
if (console->peer == -1) {
INFO("no console will be used");
return 0;
}
if (lxc_mainloop_add_handler(descr, console->master, if (lxc_mainloop_add_handler(descr, console->master,
console_handler, console)) { console_handler, console)) {
ERROR("failed to add to mainloop console handler for '%d'", ERROR("failed to add to mainloop console handler for '%d'",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment