Commit f78a1f32 by Daniel Lezcano Committed by Daniel Lezcano

fix when console is not specified

When no console is specified, do not try to setup the console. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 9b8e796c
...@@ -676,8 +676,10 @@ static int setup_console(const char *rootfs, const struct lxc_console *console) ...@@ -676,8 +676,10 @@ static int setup_console(const char *rootfs, const struct lxc_console *console)
return 0; return 0;
} }
if (console->peer == -1) if (console->peer == -1) {
INFO("no console output required"); INFO("no console output required");
return 0;
}
if (stat(path, &s)) { if (stat(path, &s)) {
SYSERROR("failed to stat '%s'", path); SYSERROR("failed to stat '%s'", path);
......
...@@ -148,6 +148,9 @@ int lxc_create_console(struct lxc_conf *conf) ...@@ -148,6 +148,9 @@ int lxc_create_console(struct lxc_conf *conf)
if (!conf->rootfs) if (!conf->rootfs)
return 0; return 0;
if (!console->path)
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");
...@@ -257,6 +260,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr, ...@@ -257,6 +260,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr,
return 0; return 0;
} }
if (!console->path) {
INFO("no console specified");
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