[CRIU] [PATCH] mount: Corrent sibling path when parent and child have the same mountpoint
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Sep 20 05:48:36 PDT 2016
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.
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;
}
More information about the CRIU
mailing list