[CRIU] [PATCH] ghost: Fix off-by-one when printing ghost path

Andrew Vagin avagin at odin.com
Tue Sep 29 07:32:20 PDT 2015


On Tue, Sep 29, 2015 at 05:18:08PM +0300, Pavel Emelyanov wrote:
> The rfi->path doesn't contain the leading /, neither does the ghost->rpath,
> so when attaching it to root don't forget to include one there.
> 
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
Acked-by: Andrew Vagin <avagin at odin.com>
> 
> ---
> 
> diff --git a/files-reg.c b/files-reg.c
> index 6851d50..f07da31 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -105,7 +105,7 @@ static int create_ghost(struct ghost_file *gf, GhostFileEntry *gfe, struct cr_im
>  		goto err;
>  	}
>  
> -	snprintf(path + ret, sizeof(path) - ret, "%s", gf->remap.rpath);
> +	snprintf(path + ret, sizeof(path) - ret, "/%s", gf->remap.rpath);
>  	ret = -1;
>  
>  	if (S_ISFIFO(gfe->mode)) {
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list