diff options
author | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-06-19 17:00:44 +0000 |
---|---|---|
committer | /C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org> | 2007-06-19 17:00:44 +0000 |
commit | 3f3a6701978df8ca16ebb5988eb7a46771deb964 (patch) | |
tree | 9a031367cd1b4322d193a85f44b15fbc645d4002 /src/run.c | |
parent | e6f0851b184123ebf04df45e2f29a59f0cb827eb (diff) | |
download | conntrack-tools-3f3a6701978df8ca16ebb5988eb7a46771deb964.tar.gz conntrack-tools-3f3a6701978df8ca16ebb5988eb7a46771deb964.zip |
- more cleanups and code refactorization
- remove several debug calls
- create a child to dispatch dump requests: this will help to simplify the
current locking schema. Later.
Diffstat (limited to 'src/run.c')
-rw-r--r-- | src/run.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -47,6 +47,11 @@ void killer(int foo) exit(0); } +static void child(int foo) +{ + while(wait(NULL) > 0); +} + void local_handler(int fd, void *data) { int ret; @@ -54,11 +59,11 @@ void local_handler(int fd, void *data) ret = read(fd, &type, sizeof(type)); if (ret == -1) { - dlog(STATE(log), "can't read from unix socket\n"); + dlog(STATE(log), "can't read from unix socket"); return; } if (ret == 0) { - debug("nothing to process\n"); + dlog(STATE(log), "local request: nothing to process?"); return; } @@ -122,6 +127,7 @@ int init(int mode) sigemptyset(&STATE(block)); sigaddset(&STATE(block), SIGTERM); sigaddset(&STATE(block), SIGINT); + sigaddset(&STATE(block), SIGCHLD); if (signal(SIGINT, killer) == SIG_ERR) return -1; @@ -133,6 +139,9 @@ int init(int mode) if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) return -1; + if (signal(SIGCHLD, child) == SIG_ERR) + return -1; + dlog(STATE(log), "[OK] initialization completed"); return 0; |