[CRIU] [PATCH] mount: Corrent sibling path when parent and child have the same mountpoint

Andrei Vagin avagin at virtuozzo.com
Wed Sep 21 10:09:03 PDT 2016


On Tue, Sep 20, 2016 at 03:48:36PM +0300, Kirill Tkhai wrote:
> When m and pa are mounted in the same directory, rpath is initialized
> to empty string (rpath[0] points to '\0'). In this case snprintf() at
> the bottom of function makes path have '/' at the end.
> 
> In further, function validate_shared(), which uses the result, calls
> find_shared_peer() and fails to find a peer.
>

Acked-by: Andrei Vagin <avagin at virtuozzo.com>

Thank you!

> https://jira.sw.ru/browse/PSBM-52346
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/path.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/criu/path.c b/criu/path.c
> index 1c7c257..c43b5e2 100644
> --- a/criu/path.c
> +++ b/criu/path.c
> @@ -94,7 +94,8 @@ char *mnt_get_sibling_path(struct mount_info *m,
>  	if (rpath[0] == '/')
>  		rpath++;
>  
> -	off = snprintf(path, len, "/%s", rpath);
> +	if (rpath[0] != '\0')
> +		off = snprintf(path, len, "/%s", rpath);
>  
>  	return buf;
>  }
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list