Commit 16866694 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

tty: Make tty_setup_slavery to return error

In case if here no task found which would restore
controlling terminal -- exit with error instead of
continue with just error message.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 293eca31
......@@ -155,7 +155,9 @@ static int root_prepare_shared(void)
mark_pipe_master();
tty_setup_slavery();
ret = tty_setup_slavery();
if (ret)
goto err;
ret = resolve_unix_peers();
if (ret)
......
......@@ -16,7 +16,7 @@
extern int dump_tty(struct fd_parms *p, int lfd, const struct cr_fdset *set);
extern int collect_tty(void);
extern int prepare_shared_tty(void);
extern void tty_setup_slavery(void);
extern int tty_setup_slavery(void);
extern int tty_verify_active_pairs(void);
......
......@@ -667,7 +667,7 @@ static int tty_find_restoring_task(struct tty_info *info)
return -1;
}
static void tty_setup_orphan_slavery(void)
static int tty_setup_orphan_slavery(void)
{
struct tty_info *info, *peer, *m;
......@@ -705,21 +705,25 @@ static void tty_setup_orphan_slavery(void)
m->tfe->id);
}
}
return 0;
}
void tty_setup_slavery(void)
int tty_setup_slavery(void)
{
struct tty_info *info, *peer, *m;
list_for_each_entry(info, &all_ttys, list) {
tty_find_restoring_task(info);
if (tty_find_restoring_task(info))
return -1;
peer = info;
list_for_each_entry_safe_continue(peer, m, &all_ttys, list) {
if (peer->tie->pty->index != info->tie->pty->index)
continue;
tty_find_restoring_task(peer);
if (tty_find_restoring_task(peer))
return -1;
list_add(&peer->sibling, &info->sibling);
list_del(&peer->list);
......@@ -735,7 +739,7 @@ void tty_setup_slavery(void)
tty_show_pty_info(" `- sibling", peer);
}
tty_setup_orphan_slavery();
return tty_setup_orphan_slavery();
}
static int verify_termios(u32 id, TermiosEntry *e)
......
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