mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-15 10:10:54 +00:00
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:
parent
9b8e796c37
commit
f78a1f32f4
@ -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)
|
|||||||
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,
|
|||||||
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'",
|
||||||
|
Loading…
Reference in New Issue
Block a user