[CRIU] [PATCH 09/11] file: use ralative path for retoring files
Pavel Emelyanov
xemul at parallels.com
Mon Aug 4 03:44:02 PDT 2014
On 07/25/2014 01:12 AM, Andrey Vagin wrote:
> 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;
Add comment that we change "/foo" into "foo" and "/" into "."
> + else
> + rfi->path = rfi->rfe->name + 1;
> rfi->remap = NULL;
> rfi->size_checked = false;
>
>
More information about the CRIU
mailing list