[CRIU] [PATCH 09/11] file: use ralative path for retoring files

Andrey Vagin avagin at openvz.org
Thu Jul 24 14:12:33 PDT 2014


openat() is used to open files, so absolute pathes can't be used

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 files-reg.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/files-reg.c b/files-reg.c
index b1cb78b..48bbbf4 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -959,9 +959,14 @@ struct file_desc *collect_special_file(u32 id)
 static int collect_one_regfile(void *o, ProtobufCMessage *base)
 {
 	struct reg_file_info *rfi = o;
+	static char dot[] = ".";
 
 	rfi->rfe = pb_msg(base, RegFileEntry);
-	rfi->path = rfi->rfe->name;
+	/* cut the first slash, because openat() is used for access */
+	if (rfi->rfe->name[1] == '\0')
+		rfi->path = dot;
+	else
+		rfi->path = rfi->rfe->name + 1;
 	rfi->remap = NULL;
 	rfi->size_checked = false;
 
-- 
1.8.5.3



More information about the CRIU mailing list