Commit d4e4e577 authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Get ns temp root path once when collecting data from image

Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 5975c94e
......@@ -1438,18 +1438,21 @@ static int rst_collect_local_mntns(void)
static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
{
MntEntry *me = NULL;
int img, ret;
int img, ret, root_len = 1;
char root[PATH_MAX] = ".";
img = open_image(CR_FD_MNTS, O_RSTR, nsid->id);
if (img < 0)
return -1;
if (nsid->id != root_item->ids->mnt_ns_id)
root_len = print_ns_root(nsid, root, sizeof(root));
pr_debug("Reading mountpoint images\n");
while (1) {
struct mount_info *pm;
char root[PATH_MAX] = ".";
int len, root_len = 1;
int len;
ret = pb_read_one_eof(img, &me, PB_MNT);
if (ret <= 0)
......@@ -1480,8 +1483,6 @@ static int collect_mnt_from_image(struct mount_info **pms, struct ns_id *nsid)
if (!pm->root)
goto err;
if (nsid->id != root_item->ids->mnt_ns_id)
root_len = print_ns_root(nsid, root, sizeof(root));
len = strlen(me->mountpoint) + root_len + 1;
pm->mountpoint = xmalloc(len);
if (!pm->mountpoint)
......
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