]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix when console is not specified
authorDaniel Lezcano <daniel.lezcano@free.fr>
Fri, 2 Apr 2010 21:37:42 +0000 (23:37 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 2 Apr 2010 21:37:42 +0000 (23:37 +0200)
When no console is specified, do not try to setup the console.

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

index 7486fdf0a04710fd4037a1871724008afa100c61..3242f17b6b2c3b7b17513d6284401a11a1eeacac 100644 (file)
@@ -676,8 +676,10 @@ static int setup_console(const char *rootfs, const struct lxc_console *console)
                return 0;
        }
 
-       if (console->peer == -1)
+       if (console->peer == -1) {
                INFO("no console output required");
+               return 0;
+       }
 
        if (stat(path, &s)) {
                SYSERROR("failed to stat '%s'", path);
index 16c5b590c296450b56826449d6fcdbe15303e8dc..f40fb0be21fafbf32c8c6d879de55226289fb1b0 100644 (file)
@@ -148,6 +148,9 @@ int lxc_create_console(struct lxc_conf *conf)
        if (!conf->rootfs)
                return 0;
 
+       if (!console->path)
+               return 0;
+
        if (openpty(&console->master, &console->slave,
                    console->name, NULL, NULL)) {
                SYSERROR("failed to allocate a pty");
@@ -257,6 +260,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr,
                return 0;
        }
 
+       if (!console->path) {
+               INFO("no console specified");
+               return 0;
+       }
+
        if (lxc_mainloop_add_handler(descr, console->master,
                                     console_handler, console)) {
                ERROR("failed to add to mainloop console handler for '%d'",