diff --git a/cr-restore.c b/cr-restore.c index 973f06e60..3254efc3f 100644 --- a/cr-restore.c +++ b/cr-restore.c @@ -1482,7 +1482,8 @@ static int create_children_and_session(void) return ret; } - restore_sid(); + if (current->parent) + restore_sid(); pr_info("Restoring children in our session:\n"); list_for_each_entry(child, ¤t->children, sibling) { @@ -1565,6 +1566,9 @@ static int restore_task_with_children(void *_arg) if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0) goto err; + pr_info("Calling restore_sid() for init\n"); + restore_sid(); + /* * We need non /proc proc mount for restoring pid and mount * namespaces and do not care for the rest of the cases.