Commit 1560f6c9 by Daniel Lezcano

fix no rootfs no console

When there is no rootfs, don't create a console. Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent e0dc0de7
...@@ -139,9 +139,13 @@ out_close: ...@@ -139,9 +139,13 @@ out_close:
return 1; return 1;
} }
int lxc_create_console(struct lxc_console *console) int lxc_create_console(struct lxc_conf *conf)
{ {
struct termios tios; struct termios tios;
struct lxc_console *console = &conf->console;
if (!conf->rootfs)
return 0;
if (openpty(&console->master, &console->slave, if (openpty(&console->master, &console->slave,
console->name, NULL, NULL)) { console->name, NULL, NULL)) {
...@@ -239,6 +243,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr, ...@@ -239,6 +243,11 @@ int lxc_console_mainloop_add(struct lxc_epoll_descr *descr,
struct lxc_conf *conf = handler->conf; struct lxc_conf *conf = handler->conf;
struct lxc_console *console = &conf->console; struct lxc_console *console = &conf->console;
if (!conf->rootfs) {
INFO("no rootfs, no console.");
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'",
......
...@@ -21,6 +21,6 @@ ...@@ -21,6 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 void lxc_delete_console(struct lxc_console *);
extern int lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_handler *); extern int lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_handler *);
...@@ -207,7 +207,7 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf) ...@@ -207,7 +207,7 @@ struct lxc_handler *lxc_init(const char *name, struct lxc_conf *conf)
goto out_aborting; goto out_aborting;
} }
if (lxc_create_console(&conf->console)) { if (lxc_create_console(conf)) {
ERROR("failed to create console"); ERROR("failed to create console");
goto out_delete_tty; goto out_delete_tty;
} }
......
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