Commit 05880800 authored by Pavel Emelyanov's avatar Pavel Emelyanov

pstree: Move the ids reading into separate function

It's just a cleanup to get rid of in-function {<code>} block.
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 070d420b
...@@ -380,6 +380,29 @@ static int prepare_pstree_for_shell_job(void) ...@@ -380,6 +380,29 @@ static int prepare_pstree_for_shell_job(void)
return 0; return 0;
} }
static int read_pstree_ids(struct pstree_item *pi)
{
int ret;
struct cr_img *img;
img = open_image(CR_FD_IDS, O_RSTR, pi->pid.virt);
if (!img)
return -1;
ret = pb_read_one_eof(img, &pi->ids, PB_IDS);
close_image(img);
if (ret <= 0)
return ret;
if (pi->ids->has_mnt_ns_id) {
if (rst_add_ns_id(pi->ids->mnt_ns_id, pi, &mnt_ns_desc))
return -1;
}
return 0;
}
static int read_pstree_image(void) static int read_pstree_image(void)
{ {
int ret = 0, i; int ret = 0, i;
...@@ -469,25 +492,9 @@ static int read_pstree_image(void) ...@@ -469,25 +492,9 @@ static int read_pstree_image(void)
pstree_entry__free_unpacked(e, NULL); pstree_entry__free_unpacked(e, NULL);
{ ret = read_pstree_ids(pi);
struct cr_img *img;
img = open_image(CR_FD_IDS, O_RSTR, pi->pid.virt);
if (!img)
goto err;
ret = pb_read_one_eof(img, &pi->ids, PB_IDS);
close_image(img);
}
if (ret == 0)
continue;
if (ret < 0) if (ret < 0)
goto err; goto err;
if (pi->ids->has_mnt_ns_id) {
if (rst_add_ns_id(pi->ids->mnt_ns_id, pi, &mnt_ns_desc))
goto err;
}
} }
err: err:
close_image(img); close_image(img);
......
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