Commit e59a81ba authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

proc_parse: handle a return code of fopen_proc

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4a36feac
...@@ -1822,15 +1822,15 @@ int parse_threads(int pid, struct pid **_t, int *_n) ...@@ -1822,15 +1822,15 @@ int parse_threads(int pid, struct pid **_t, int *_n)
int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n) int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n)
{ {
int ret = 0;
FILE *f; FILE *f;
f = fopen_proc(pid, "cgroup"); f = fopen_proc(pid, "cgroup");
if (f == NULL)
return -1;
while (fgets(buf, BUF_SIZE, f)) { while (fgets(buf, BUF_SIZE, f)) {
struct cg_ctl *ncc, *cc; struct cg_ctl *ncc, *cc;
char *name, *path = NULL, *e; char *name, *path = NULL, *e;
ret = -1;
ncc = xmalloc(sizeof(*cc)); ncc = xmalloc(sizeof(*cc));
if (!ncc) if (!ncc)
goto err; goto err;
...@@ -1878,7 +1878,7 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n) ...@@ -1878,7 +1878,7 @@ int parse_task_cgroup(int pid, struct list_head *retl, unsigned int *n)
err: err:
put_ctls(retl); put_ctls(retl);
fclose(f); fclose(f);
return ret; return -1;
} }
void put_ctls(struct list_head *l) void put_ctls(struct list_head *l)
......
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