diff --git a/criu/mount.c b/criu/mount.c index f4748d1c6..4919bd323 100644 --- a/criu/mount.c +++ b/criu/mount.c @@ -3050,13 +3050,12 @@ int prepare_mnt_ns(void) pr_perror("Can't restore mntns back"); goto err; } - nsid->mnt.ns_fd = rst; - rst = fd; - } else { - /* Pin one with a file descriptor */ - nsid->mnt.ns_fd = fd; + SWAP(rst, fd); } + /* Pin one with a file descriptor */ + nsid->mnt.ns_fd = fd; + /* Set its root */ path[0] = '/'; print_ns_root(nsid, 0, path + 1, sizeof(path) - 1);