mirror of
https://github.com/troglobit/finit.git
synced 2026-12-05 22:08:20 +00:00
initctl: skip cgroup in status output pid_cgruop() fails
In some (error) cases the PID known to Finit may no longer exist, or may not have been added to a cgroup (yet). Handle this case by skipping the output of cgroup info in such conditions. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
078a1d0c95
commit
57329832d0
1 file changed
+3
@@ -831,6 +831,8 @@ static int show_status(char *arg)
|
|||||||
char *group;
|
char *group;
|
||||||
|
|
||||||
group = pid_cgroup(svc->pid, grbuf, sizeof(grbuf));
|
group = pid_cgroup(svc->pid, grbuf, sizeof(grbuf));
|
||||||
|
if (!group)
|
||||||
|
goto no_cgroup; /* ... or PID doesn't exist (anymore) */
|
||||||
snprintf(path, sizeof(path), "%s/%s", FINIT_CGPATH, group);
|
snprintf(path, sizeof(path), "%s/%s", FINIT_CGPATH, group);
|
||||||
cg = cg_conf(path);
|
cg = cg_conf(path);
|
||||||
|
|
||||||
@@ -840,6 +842,7 @@ static int show_status(char *arg)
|
|||||||
cg->cg_mem.min, cg->cg_mem.max);
|
cg->cg_mem.min, cg->cg_mem.max);
|
||||||
show_cgroup_tree(group, " ");
|
show_cgroup_tree(group, " ");
|
||||||
}
|
}
|
||||||
|
no_cgroup:
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return do_log(svc->cmd);
|
return do_log(svc->cmd);
|
||||||
|
|||||||
Reference in new issue
Block a user