diff --git a/criu/cr-restore.c b/criu/cr-restore.c index 9717b17d1..e08e6ed6f 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -1051,9 +1051,6 @@ static int setup_newborn_fds(struct pstree_item *me) return -1; } - if (log_init_by_pid(vpid(me))) - return -1; - return 0; } @@ -1607,9 +1604,6 @@ static int restore_task_with_children(void *_arg) if ( !(ca->clone_flags & CLONE_FILES)) close_safe(&ca->fd); - if (setup_newborn_fds(current)) - goto err; - pid = getpid(); if (vpid(current) != pid) { pr_err("Pid %d do not match expected %d\n", pid, vpid(current)); @@ -1617,6 +1611,9 @@ static int restore_task_with_children(void *_arg) goto err; } + if (log_init_by_pid(vpid(current))) + return -1; + if (current->parent == NULL) { /* * The root task has to be in its namespaces before executing @@ -1683,6 +1680,9 @@ static int restore_task_with_children(void *_arg) goto err; } + if (setup_newborn_fds(current)) + goto err; + if (restore_task_mnt_ns(current)) goto err;