Commit f0ea03bd authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

mount: Corrent sibling path when parent and child have the same mountpoint

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.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 5f30c249
...@@ -94,7 +94,8 @@ char *mnt_get_sibling_path(struct mount_info *m, ...@@ -94,7 +94,8 @@ char *mnt_get_sibling_path(struct mount_info *m,
if (rpath[0] == '/') if (rpath[0] == '/')
rpath++; rpath++;
off = snprintf(path, len, "/%s", rpath); if (rpath[0] != '\0')
off = snprintf(path, len, "/%s", rpath);
return buf; return buf;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment