2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

proc_parse: handle a return code of fopen_proc

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2015-04-21 16:54:39 +03:00
committed by Pavel Emelyanov
parent 4a36feacc7
commit e59a81bab6

View File

@@ -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)
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)