]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix no rootfs no console
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 24 Feb 2010 09:57:43 +0000 (10:57 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Wed, 24 Feb 2010 09:57:43 +0000 (10:57 +0100)
When there is no rootfs, don't create a console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/console.c
src/lxc/console.h
src/lxc/start.c

index c14a38bc036fd9f56c7b9001999d82bc217e69c8..c2bc29bb42c7233fac77aca56e6b35840b23ac1a 100644 (file)
@@ -139,9 +139,13 @@ out_close:
        return 1;
 }
 
-int lxc_create_console(struct lxc_console *console)
+int lxc_create_console(struct lxc_conf *conf)
 {
        struct termios tios;
+       struct lxc_console *console = &conf->console;
+
+       if (!conf->rootfs)
+               return 0;
 
        if (openpty(&console->master, &console->slave,
                    console->name, NULL, NULL)) {
@@ -239,6 +243,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr,
        struct lxc_conf *conf = handler->conf;
        struct lxc_console *console = &conf->console;
 
+       if (!conf->rootfs) {
+               INFO("no rootfs, no console.");
+               return 0;
+       }
+
        if (lxc_mainloop_add_handler(descr, console->master,
                                     console_handler, console)) {
                ERROR("failed to add to mainloop console handler for '%d'",
index b465cc72e069f9314cb09b3baa4307f8f2537ee2..5b47df37332ff5ffc586af60db11481d2edc1406 100644 (file)
@@ -21,6 +21,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-extern int lxc_create_console(struct lxc_console *);
+extern int lxc_create_console(struct lxc_conf *);
 extern void lxc_delete_console(struct lxc_console *);
 extern int lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_handler *);
index f4293f73b65a61261b0edcfc0f1cdf3d84c092c5..4b75577fd8738e405868d515055b482594f2fc5b 100644 (file)
@@ -207,7 +207,7 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf)
                goto out_aborting;
        }
 
-       if (lxc_create_console(&conf->console)) {
+       if (lxc_create_console(conf)) {
                ERROR("failed to create console");
                goto out_delete_tty;
        }