[CRIU] [PATCH 5/5] tty: allocate a separate tty info id for each external tty

Andrey Vagin avagin at virtuozzo.com
Fri Sep 21 01:22:38 MSK 2018


Otherwise all external tty-s will share the same tty info,
what is obviously wrong.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
 criu/tty.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/criu/tty.c b/criu/tty.c
index 214d97a8e..7fd4d86b1 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -2005,6 +2005,7 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
 	TtyFileEntry e = TTY_FILE_ENTRY__INIT;
 	int ret = 0, index = -1;
 	struct tty_driver *driver;
+	static int idx = 0;
 
 	pr_info("Dumping tty %d with id %#x\n", lfd, id);
 
@@ -2012,7 +2013,7 @@ static int dump_one_tty(int lfd, u32 id, const struct fd_parms *p)
 	if (driver->fd_get_index)
 		index = driver->fd_get_index(lfd, p);
 	else
-		index = driver->index;
+		index = ++idx;
 
 	if (index == INDEX_ERR) {
 		pr_info("Can't obtain index on tty %d id %#x\n", lfd, id);
-- 
2.14.4




More information about the CRIU mailing list