diff --git a/cr-restore.c b/cr-restore.c index d58b97040..71c8cdf4a 100644 --- a/cr-restore.c +++ b/cr-restore.c @@ -78,7 +78,19 @@ static int shmem_remap(void *old_addr, void *new_addr, unsigned long size) return 0; } -static int prepare_shared(void) +static int crtools_prepare_shared(void) +{ + if (prepare_shared_fdinfo()) + return -1; + + /* Connections are unlocked from crtools */ + if (collect_inet_sockets()) + return -1; + + return 0; +} + +static int root_prepare_shared(void) { int ret = 0; struct pstree_item *pi; @@ -88,13 +100,9 @@ static int prepare_shared(void) if (prepare_shmem_restore()) return -1; - if (prepare_shared_fdinfo()) - return -1; - if (prepare_shared_tty()) return -1; - if (collect_reg_files()) return -1; @@ -104,9 +112,6 @@ static int prepare_shared(void) if (collect_fifo()) return -1; - if (collect_inet_sockets()) - return -1; - if (collect_unix_sockets()) return -1; @@ -761,7 +766,7 @@ static int restore_task_with_children(void *_arg) if (mount_proc()) exit(-1); - if (prepare_shared()) + if (root_prepare_shared()) exit(-1); } @@ -951,6 +956,9 @@ int cr_restore_tasks(pid_t pid, struct cr_options *opts) if (prepare_pstree_ids() < 0) return -1; + if (crtools_prepare_shared() < 0) + return -1; + futex_set(&task_entries->nr_in_progress, task_entries->nr_tasks + task_entries->nr_helpers); return restore_root_task(root_item, opts);