mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +00:00
image: Open parent image dir with -at calls
After fixes with -W option we've changed the cwd at the time parent images are opened. Use the -at syscall to proerly access ones. [ Cleanup and comment from xemul@ ] Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
80559828d6
commit
486cad37cc
16
image.c
16
image.c
@@ -241,25 +241,27 @@ int open_image_dir(char *dir)
|
|||||||
|
|
||||||
ret = install_service_fd(IMG_FD_OFF, fd);
|
ret = install_service_fd(IMG_FD_OFF, fd);
|
||||||
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
if (opts.img_parent) {
|
if (opts.img_parent) {
|
||||||
ret = symlink(opts.img_parent, CR_PARENT_LINK);
|
int pfd;
|
||||||
|
|
||||||
|
ret = symlinkat(opts.img_parent, fd, CR_PARENT_LINK);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_perror("Can't link parent snapshot.");
|
pr_perror("Can't link parent snapshot.");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(CR_PARENT_LINK, O_RDONLY);
|
pfd = openat(fd, CR_PARENT_LINK, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (pfd < 0) {
|
||||||
pr_perror("Can't open parent snapshot.");
|
pr_perror("Can't open parent snapshot.");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = install_service_fd(PARENT_FD_OFF, fd);
|
ret = install_service_fd(PARENT_FD_OFF, pfd);
|
||||||
|
|
||||||
|
close(pfd);
|
||||||
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user