diff --git a/criu/tty.c b/criu/tty.c index 51516c731..de4195ab6 100644 --- a/criu/tty.c +++ b/criu/tty.c @@ -372,7 +372,7 @@ static int tty_get_index(u32 id) } /* Make sure the active pairs do exist */ -static int tty_verify_active_pairs(void * unused) +static int tty_verify_active_pairs(void) { unsigned long i, unpaired_slaves = 0; @@ -1360,7 +1360,7 @@ static int tty_setup_orphan_slavery(void) return 0; } -static int tty_setup_slavery(void * unused) +static int tty_setup_slavery(void) { struct tty_info *info, *peer, *m; @@ -1556,6 +1556,15 @@ struct collect_image_info tty_info_cinfo = { .collect = collect_one_tty_info_entry, }; +static int prep_tty_restore(void *unused) +{ + if (tty_verify_active_pairs()) + return -1; + if (tty_setup_slavery()) + return -1; + return 0; +} + static int collect_one_tty(void *obj, ProtobufCMessage *msg, struct cr_img *i) { struct tty_info *info = obj; @@ -1626,8 +1635,7 @@ 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 (add_post_prepare_cb_once(tty_verify_active_pairs, NULL) || - add_post_prepare_cb_once(tty_setup_slavery, NULL)) + if (add_post_prepare_cb_once(prep_tty_restore, NULL)) return -1; info->fdstore_id = -1; @@ -2152,7 +2160,7 @@ int tty_post_actions(void) { if (tty_verify_ctty()) return -1; - if (tty_verify_active_pairs(NULL)) + if (tty_verify_active_pairs()) return -1; else if (tty_dump_queued_data()) return -1;