[CRIU] [PATCH 1/2] proc: parse_children appens new processes to a specified array
Andrey Vagin
avagin at openvz.org
Tue Oct 27 04:13:20 PDT 2015
From: Andrew Vagin <avagin at openvz.org>
parse_threads alread does this. If an array isn't specified,
it will allocate a new one.
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
cr-dump.c | 2 +-
proc_parse.c | 5 +++++
seize.c | 2 +-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/cr-dump.c b/cr-dump.c
index fea3be6..25323d7 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -956,7 +956,7 @@ static int fill_zombies_pids(struct pstree_item *item)
{
struct pstree_item *child;
int i, nr;
- pid_t *ch;
+ pid_t *ch = NULL;
/*
* Pids read here are virtual -- caller has set up
diff --git a/proc_parse.c b/proc_parse.c
index 1302cda..4f8e05c 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -2141,6 +2141,11 @@ int parse_children(pid_t pid, pid_t **_c, int *_n)
struct dirent *de;
struct bfd f;
+ if (*_c) {
+ ch = *_c;
+ nr = *_n;
+ }
+
dir = opendir_proc(pid, "task");
if (dir == NULL)
return -1;
diff --git a/seize.c b/seize.c
index 5ad7ce9..0f93b84 100644
--- a/seize.c
+++ b/seize.c
@@ -215,7 +215,7 @@ static inline bool child_collected(struct pstree_item *i, pid_t pid)
static int collect_task(struct pstree_item *item);
static int collect_children(struct pstree_item *item)
{
- pid_t *ch;
+ pid_t *ch = NULL;
int ret, i, nr_children, nr_inprogress;
ret = parse_children(item->pid.real, &ch, &nr_children);
--
2.4.3
More information about the CRIU
mailing list