From 0105e543a7df7ea492e21c239b31537e2de1c52c Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 14 Sep 2012 17:50:44 +0400 Subject: [PATCH] tty: Dump a hanging up terminal If we've met a hanging up terminal we can escape lot of work but dump a minimum information needed for restore. Signed-off-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- tty.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tty.c b/tty.c index ffcf750c2..0c54a49df 100644 --- a/tty.c +++ b/tty.c @@ -806,16 +806,25 @@ static int dump_pty_info(int lfd, u32 id, const struct fd_parms *p, int major, i info.sid = sid; info.pgrp = pgrp; info.rdev = p->stat.st_rdev; - info.termios = &termios; - info.termios_locked = &termios_locked; - info.winsize = &winsize; info.pty = &pty; pty.index = index; + /* + * Nothing we can do on hangin up terminal, + * just write out minimum information we can + * gather. + */ + if (hangup) + return pb_write_one(fdset_fd(glob_fdset, CR_FD_TTY_INFO), &info, PB_TTY_INFO); + if (pty_get_flags(lfd, major, index, &info)) goto out; + info.termios = &termios; + info.termios_locked = &termios_locked; + info.winsize = &winsize; + termios.n_c_cc = TERMIOS_NCC; termios.c_cc = xmalloc(pb_repeated_size(&termios, c_cc));