mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
tty: Make termios and winsize being optional params
The dangling slave peers might have no data associate with them if master peer is closed and link is hanging up. Thus make this parameters optional to not blow the image with data which never will be used. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
52a2c9fd77
commit
978cecd629
2 changed files with 22 additions and 16 deletions
|
|
@ -47,9 +47,9 @@ message tty_info_entry {
|
|||
*/
|
||||
required uint32 rdev = 8;
|
||||
|
||||
required termios_entry termios = 9;
|
||||
required termios_entry termios_locked = 10;
|
||||
required winsize_entry winsize = 11;
|
||||
optional termios_entry termios = 9;
|
||||
optional termios_entry termios_locked = 10;
|
||||
optional winsize_entry winsize = 11;
|
||||
|
||||
/*
|
||||
* These are optional fields which presense depends on
|
||||
|
|
|
|||
32
tty.c
32
tty.c
|
|
@ -412,20 +412,26 @@ static int restore_tty_params(int fd, struct tty_info *info)
|
|||
* never be extended.
|
||||
*/
|
||||
|
||||
memzero(&t, sizeof(t));
|
||||
termios_copy(&t, info->tie->termios_locked);
|
||||
if (ioctl(fd, TIOCSLCKTRMIOS, &t) < 0)
|
||||
goto err;
|
||||
if (info->tie->termios_locked) {
|
||||
memzero(&t, sizeof(t));
|
||||
termios_copy(&t, info->tie->termios_locked);
|
||||
if (ioctl(fd, TIOCSLCKTRMIOS, &t) < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
memzero(&t, sizeof(t));
|
||||
termios_copy(&t, info->tie->termios);
|
||||
if (ioctl(fd, TCSETS, &t) < 0)
|
||||
goto err;
|
||||
if (info->tie->termios) {
|
||||
memzero(&t, sizeof(t));
|
||||
termios_copy(&t, info->tie->termios);
|
||||
if (ioctl(fd, TCSETS, &t) < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
memzero(&w, sizeof(w));
|
||||
winsize_copy(&w, info->tie->winsize);
|
||||
if (ioctl(fd, TIOCSWINSZ, &w) < 0)
|
||||
goto err;
|
||||
if (info->tie->winsize) {
|
||||
memzero(&w, sizeof(w));
|
||||
winsize_copy(&w, info->tie->winsize);
|
||||
if (ioctl(fd, TIOCSWINSZ, &w) < 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
|
|
@ -632,7 +638,7 @@ static int tty_setup_slavery(void)
|
|||
|
||||
static int veirfy_termios(u32 id, TermiosEntry *e)
|
||||
{
|
||||
if (e->n_c_cc < TERMIOS_NCC) {
|
||||
if (e && e->n_c_cc < TERMIOS_NCC) {
|
||||
pr_err("pty ID %#x n_c_cc (%d) has wrong value\n",
|
||||
id, (int)e->n_c_cc);
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue