diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-06-11 19:26:49 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-06-11 19:26:49 +0200 |
commit | 6cd381e590bf28c180c089b47667defe4b6ff3eb (patch) | |
tree | 335cf3730091955d26b0bb8630a376c3bde9e949 /src | |
parent | c72da10b9b1193f7ecb84a5db7dbf943891b9e96 (diff) | |
download | conntrack-tools-6cd381e590bf28c180c089b47667defe4b6ff3eb.tar.gz conntrack-tools-6cd381e590bf28c180c089b47667defe4b6ff3eb.zip |
conntrackd: add missing initialization of PID in process infrastructure
In 0374398fd14bf587d80d9d31e361e266e69387c8, I introduced the process
infrastructure. However, that patch missed the PID initialization.
Without this patch, the process structures are never released.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/process.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c index a89f388..70972fe 100644 --- a/src/process.c +++ b/src/process.c @@ -24,6 +24,7 @@ static LIST_HEAD(process_list); int fork_process_new(void (*cb)(void *data), void *data) { struct child_process *c; + int pid; c = calloc(sizeof(struct child_process), 1); if (c == NULL) @@ -31,10 +32,12 @@ int fork_process_new(void (*cb)(void *data), void *data) c->cb = cb; c->data = data; + c->pid = pid = fork(); - list_add(&c->head, &process_list); + if (c->pid > 0) + list_add(&c->head, &process_list); - return fork(); + return pid; } int fork_process_delete(int pid) |