Commit d49fd40e authored by Pavel Emelyanov's avatar Pavel Emelyanov

mnt: Sanitize the code of reading mnt images routine

Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4ffa7969
...@@ -1535,29 +1535,21 @@ static struct mount_info *read_mnt_ns_img(void) ...@@ -1535,29 +1535,21 @@ static struct mount_info *read_mnt_ns_img(void)
struct mount_info *pms = NULL; struct mount_info *pms = NULL;
struct ns_id *nsid; struct ns_id *nsid;
nsid = ns_ids; for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
while (nsid) { if (nsid->nd != &mnt_ns_desc)
if (nsid->nd != &mnt_ns_desc) {
nsid = nsid->next;
continue; continue;
}
if (nsid->id != root_item->ids->mnt_ns_id) if (nsid->id != root_item->ids->mnt_ns_id)
if (create_mnt_roots(true)) if (create_mnt_roots(true))
return NULL; return NULL;
if (collect_mnt_from_image(&pms, nsid)) if (collect_mnt_from_image(&pms, nsid))
goto err; return NULL;
nsid = nsid->next;
} }
/* Here is not matter where the mount list is saved */ /* Here it doesn't matter where the mount list is saved */
mntinfo = pms; mntinfo = pms;
return pms; return pms;
err:
return NULL;
} }
char *rst_get_mnt_root(int mnt_id) char *rst_get_mnt_root(int mnt_id)
......
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