[4/5] tty: Set active-pairs bit once

Submitted by Pavel Emelianov on July 19, 2017, 11:20 a.m.

Details

Message ID dd4a1e03-b44e-e0f3-3a24-e7f2476ec7e5@virtuozzo.com
State Accepted
Series "Merge tty files into files image"
Headers show

Commit Message

Pavel Emelianov July 19, 2017, 11:20 a.m.
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
---
 criu/tty.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/tty.c b/criu/tty.c
index abeb483..0076348 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1563,6 +1563,16 @@  static int collect_one_tty_info_entry(void *obj, ProtobufCMessage *msg, struct c
 			return -1;
 	}
 
+	/*
+	 * The tty peers which have no @termios are hung up,
+	 * so don't mark them as active, we create them with
+	 * faked master and they are rather a rudiment which
+	 * can't be used. Most likely they appear if a user has
+	 * dumped program when it was closing a peer.
+	 */
+	if (is_pty(driver) && tie->termios)
+		tty_test_and_set(tie->id, tty_active_pairs);
+
 	return 0;
 }
 
@@ -1636,16 +1646,6 @@  static int tty_info_setup(struct tty_info *info)
 		}
 	}
 
-	/*
-	 * The tty peers which have no @termios are hung up,
-	 * so don't mark them as active, we create them with
-	 * faked master and they are rather a rudiment which
-	 * can't be used. Most likely they appear if a user has
-	 * dumped program when it was closing a peer.
-	 */
-	if (is_pty(info->driver) && info->tie->termios)
-		tty_test_and_set(info->tfe->tty_info_id, tty_active_pairs);
-
 	pr_info("Collected tty ID %#x (%s)\n", info->tfe->id, info->driver->name);
 
 	add_post_prepare_cb_once(&prep_tty_restore);