2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

tty: Lookup for controlling tty iif sid provided

This is rather a code tossing for the next patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2012-10-29 13:35:47 +04:00
committed by Pavel Emelyanov
parent 1b060e1470
commit 5cb163411e

18
tty.c
View File

@@ -682,15 +682,19 @@ static int tty_find_restoring_task(struct tty_info *info)
{
struct pstree_item *item;
if (info->tie->sid == 0)
if (info->tie->sid) {
pr_info("Set a control terminal %x to %d\n",
info->tfe->id, info->tie->sid);
for_each_pstree_item(item) {
if (item->sid == info->tie->sid)
return prepare_ctl_tty(item->pid.virt,
item->rst,
info->tfe->id);
}
} else
return 0;
pr_info("Set a control terminal to %d\n", info->tie->sid);
for_each_pstree_item(item)
if (item->sid == info->tie->sid)
return prepare_ctl_tty(item->pid.virt, item->rst, info->tfe->id);
if (opts.shell_job && !pty_is_master(info)) {
info->tie->sid = info->tie->pgrp = INHERIT_SID;
return 0;