[CRIU] [PATCH 10/11] file: use ralative path for retoring files
Andrey Vagin
avagin at openvz.org
Sun Aug 3 11:31:24 PDT 2014
openat() is used to open files, so absolute pathes can't be used
v2: change the comment
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 b72c821..069cb3a 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -961,9 +961,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;
+ /* change "/foo" into "foo" and "/" into "." */
+ 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