[CRIU] [PATCH] image: img_parent symlinkat and openat images dir
Ruslan Kuprieiev
kupruser at gmail.com
Sat Nov 16 06:55:17 PST 2013
This patch will fix zdtm test failure.
Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
image.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/image.c b/image.c
index 1d8e97c..d696bdb 100644
--- a/image.c
+++ b/image.c
@@ -231,36 +231,36 @@ err:
int open_image_dir(char *dir)
{
- int fd, ret;
+ int fd1, fd2, ret;
- fd = open(dir, O_RDONLY);
- if (fd < 0) {
+ fd1 = open(dir, O_RDONLY);
+ if (fd1 < 0) {
pr_perror("Can't open dir %s", dir);
return -1;
}
- ret = install_service_fd(IMG_FD_OFF, fd);
-
- close(fd);
+ ret = install_service_fd(IMG_FD_OFF, fd1);
if (opts.img_parent) {
- ret = symlink(opts.img_parent, CR_PARENT_LINK);
+ ret = symlinkat(opts.img_parent, fd1, CR_PARENT_LINK);
if (ret < 0) {
pr_perror("Can't link parent snapshot.");
goto err;
}
- fd = open(CR_PARENT_LINK, O_RDONLY);
- if (fd < 0) {
+ fd2 = openat(fd1, CR_PARENT_LINK, O_RDONLY);
+ if (fd2 < 0) {
pr_perror("Can't open parent snapshot.");
goto err;
}
- ret = install_service_fd(PARENT_FD_OFF, fd);
+ ret = install_service_fd(PARENT_FD_OFF, fd2);
- close(fd);
+ close(fd2);
}
+ close(fd1);
+
return ret;
err:
--
1.8.1.2
More information about the CRIU
mailing list