mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 14:51:32 +00:00
c/r: detatch from controlling tty on restore
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
This commit is contained in:
parent
2b8640dfbf
commit
a7fb6043b9
@ -662,9 +662,22 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
|
|||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
struct lxc_handler *handler;
|
struct lxc_handler *handler;
|
||||||
int status;
|
int status, fd;
|
||||||
int pipes[2] = {-1, -1};
|
int pipes[2] = {-1, -1};
|
||||||
|
|
||||||
|
/* Try to detach from the current controlling tty if it exists.
|
||||||
|
* Othwerise, lxc_init (via lxc_console) will attach the container's
|
||||||
|
* console output to the current tty, which is probably not what any
|
||||||
|
* library user wants, and if they do, they can just manually configure
|
||||||
|
* it :)
|
||||||
|
*/
|
||||||
|
fd = open("/dev/tty", O_RDWR);
|
||||||
|
if (fd >= 0) {
|
||||||
|
if (ioctl(fd, TIOCNOTTY, NULL) < 0)
|
||||||
|
SYSERROR("couldn't detach from tty");
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
handler = lxc_init(c->name, c->lxc_conf, c->config_path);
|
handler = lxc_init(c->name, c->lxc_conf, c->config_path);
|
||||||
if (!handler)
|
if (!handler)
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user