2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

tty: Fix deprecation detection logic

When collecting tty records the @id may come in
as external tty entry which has no regular file
record (because it gonna be inherited on the
restore from the command line option).

Thus, make sure that deprecated_ok() is never
called on external ttys.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov
2016-09-07 21:39:00 +03:00
committed by Pavel Emelyanov
parent 0daef3d12f
commit 46c24c00bb

View File

@@ -1538,10 +1538,17 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
* The image might have no reg file record in old CRIU, so
* lets don't fail for a while. After a couple of releases
* simply require the record to present.
*
* Note for external ttys it's fine to not have any
* reg file rectord because they are inherited from
* command line on restore.
*/
info->reg_d = try_collect_special_file(info->tfe->id, 1);
if (!info->reg_d) {
if (!deprecated_ok("TTY w/o regfile"))
if (info->driver->type != TTY_TYPE__EXT_TTY) {
pr_err("No reg_d descriptor for id %#x\n", info->tfe->id);
return -1;
} else if (!deprecated_ok("TTY w/o regfile"))
return -1;
if (is_pty(info->driver)) {
@@ -1551,9 +1558,6 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
info->tfe->id);
return -1;
}
} else if (info->driver->type != TTY_TYPE__EXT_TTY) {
pr_err("No reg_d descriptor for id %#x\n", info->tfe->id);
return -1;
}
}