mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-22 01:31:34 +00:00
mount: change cwd on the root before restoring mntns (v2)
We are going to make pivot_root after restoring mount name-space, so relative paths will be used for mountpoints. v2: print correct root in a error message Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
7e096fb1c9
commit
245fa6ea56
1 changed files with 5 additions and 4 deletions
9
mount.c
9
mount.c
|
|
@ -1275,10 +1275,6 @@ static int cr_pivot_root(struct mount_info *mis)
|
|||
|
||||
pr_info("Move the root to %s\n", opts.root);
|
||||
|
||||
if (chdir(opts.root)) {
|
||||
pr_perror("chdir(%s) failed", opts.root);
|
||||
return -1;
|
||||
}
|
||||
if (mkdtemp(put_root) == NULL) {
|
||||
pr_perror("Can't create a temporary directory");
|
||||
return -1;
|
||||
|
|
@ -1472,6 +1468,11 @@ int prepare_mnt_ns(int ns_pid)
|
|||
* prior to recreating new ones.
|
||||
*/
|
||||
|
||||
if (chdir(opts.root ? : "/")) {
|
||||
pr_perror("chdir(%s) failed", opts.root ? : "/");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (opts.root)
|
||||
ret = cr_pivot_root(mis);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue