Commit eb3f46f3 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

pstree: Exit with error instead of BUG if image corrupted

No need to panic if image corrupted and we can exit
out graciously.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4797f723
...@@ -150,7 +150,11 @@ int prepare_pstree(void) ...@@ -150,7 +150,11 @@ int prepare_pstree(void)
max_pid = max((int)e->sid, max_pid); max_pid = max((int)e->sid, max_pid);
if (e->ppid == 0) { if (e->ppid == 0) {
BUG_ON(root_item); if (root_item) {
pr_err("Parent missed on non-root task "
"with pid %d, image corruption!\n", e->pid);
goto err;
}
root_item = pi; root_item = pi;
pi->parent = NULL; pi->parent = NULL;
INIT_LIST_HEAD(&pi->list); INIT_LIST_HEAD(&pi->list);
...@@ -198,6 +202,7 @@ int prepare_pstree(void) ...@@ -198,6 +202,7 @@ int prepare_pstree(void)
pstree_entry__free_unpacked(e, NULL); pstree_entry__free_unpacked(e, NULL);
} }
err:
close(ps_fd); close(ps_fd);
return ret; return ret;
} }
......
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