Commit 8ba63724 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

tty: Don't forget to setup peers mode on restore

In commit c6bc7259c we've started to carry @mode of the
files we're opening on restore, implying they are
static and should not be changed. This is true for
regular files but the pty peers are created
dynamically so if someone have set some special
mode beore the checkpoint procedure we will fail
on restore when regular file engine test it. So lets
setup @mode unconditionally.

https://travis-ci.org/xemul/criu/jobs/140011141Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 6d098278
......@@ -515,6 +515,27 @@ static void pty_free_fake_reg(struct reg_file_info **r)
}
}
static int do_open_tty_reg(int ns_root_fd, struct reg_file_info *rfi, void *arg)
{
int fd;
fd = do_open_reg_noseek_flags(ns_root_fd, rfi, arg);
if (fd >= 0) {
/*
* Peers might have differend modes set
* after creation before we've dumped
* them. So simply setup mode from image
* the regular file engine will check
* for this, so if we fail here it
* gonna be catched anyway.
*/
if (rfi->rfe->has_mode)
fchmod(fd, rfi->rfe->mode);
}
return fd;
}
static int open_tty_reg(struct file_desc *reg_d, u32 flags)
{
/*
......@@ -522,7 +543,7 @@ static int open_tty_reg(struct file_desc *reg_d, u32 flags)
* ctty magic happens only in tty_set_sid().
*/
flags |= O_NOCTTY;
return open_path(reg_d, do_open_reg_noseek_flags, &flags);
return open_path(reg_d, do_open_tty_reg, &flags);
}
static char *path_from_reg(struct file_desc *d)
......
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