]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
explicitly do not use the console
authorDaniel Lezcano <daniel.lezcano@free.fr>
Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 9 Aug 2011 14:51:01 +0000 (16:51 +0200)
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>
doc/lxc.conf.sgml.in
src/lxc/console.c

index c4cb3272a52a9eebac1d0a14096e1a65e92fae5c..cfaa686990690eac1302e0d3b7f587b960c08670 100644 (file)
@@ -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>
index b5fc270a98f3f26c8e2e41b212007eb4702cbaaf..73bec783341f9d6ddd0482391c0130761f4a16f6 100644 (file)
@@ -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'",