[CRIU] [PATCH 2/3] tty: Use add_post_prepare_cb_once

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 30 06:55:36 PDT 2017


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/tty.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/criu/tty.c b/criu/tty.c
index d49aafd61b12..156f05e66413 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1625,12 +1625,9 @@ static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i)
 
 	pr_info("Collected tty ID %#x (%s)\n", info->tfe->id, info->driver->name);
 
-	if (list_empty(&all_ttys)) {
-		if (add_post_prepare_cb(tty_verify_active_pairs, NULL))
-			return -1;
-		if (add_post_prepare_cb(tty_setup_slavery, NULL))
-			return -1;
-	}
+	if (add_post_prepare_cb_once(tty_verify_active_pairs, NULL) ||
+	    add_post_prepare_cb_once(tty_setup_slavery, NULL))
+		return -1;
 
 	info->fdstore_id = -1;
 	list_add(&info->list, &all_ttys);
-- 
2.7.4



More information about the CRIU mailing list