fix when console is not specified

When no console is specified, do not try to setup the console.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Daniel Lezcano 2010-04-02 23:37:42 +02:00 committed by Daniel Lezcano
parent 9b8e796c37
commit f78a1f32f4
2 changed files with 11 additions and 1 deletions

View 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);

View 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'",