[CRIU] [PATCH] tty: restore sid on master points only

Andrey Vagin avagin at openvz.org
Tue Mar 19 11:13:35 EDT 2013


If a master point has sid, it doesn't mean, that all slave points
will have sid. Look at tty03 for example:

  PID   SID TT       COMMAND
26748 26748 ?        tty03
26749 26749 pts/2     \_ tty03
26750 26750 ?             \_ tty03

The second process has not a file descriptor for the ctl tty,
but this tty is opened in tty03.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm.sh | 1 +
 tty.c        | 6 ++----
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/zdtm.sh b/test/zdtm.sh
index 3ecba36..4163282 100755
--- a/test/zdtm.sh
+++ b/test/zdtm.sh
@@ -73,6 +73,7 @@ static/pty00
 static/pty01
 static/pty04
 static/tty02
+static/tty03
 static/child_opened_proc
 static/cow01
 static/fpu00
diff --git a/tty.c b/tty.c
index 251930b..a9cc11a 100644
--- a/tty.c
+++ b/tty.c
@@ -731,10 +731,8 @@ static int tty_find_restoring_task(struct tty_info *info)
 	}
 
 	if (info->tie->sid) {
-		if (pty_is_master(info)) {
-			if (tty_has_active_pair(info))
-				return 0;
-		}
+		if (!pty_is_master(info))
+			return 0;
 
 		/*
 		 * Find out the task which is session leader
-- 
1.7.11.7



More information about the CRIU mailing list