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> | 2008-01-15 15:41:13 +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> | 2008-01-15 15:41:13 +0000 |
commit | 5b4129a89e9fa3ea3b5d57fc362f682aa85abfc7 (patch) | |
tree | 88fabdc48246ff409c8349d43fac04f5fca1b02b | |
parent | 588abed2a7df4fa1723475e41399876f3ee34250 (diff) | |
download | conntrack-tools-5b4129a89e9fa3ea3b5d57fc362f682aa85abfc7.tar.gz conntrack-tools-5b4129a89e9fa3ea3b5d57fc362f682aa85abfc7.zip |
remove unix socket file on exit
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | include/local.h | 2 | ||||
-rw-r--r-- | src/local.c | 6 | ||||
-rw-r--r-- | src/run.c | 2 |
4 files changed, 8 insertions, 3 deletions
@@ -43,6 +43,7 @@ o add support for tagged vlan interfaces in the config file, e.g. eth0.1 o improve alarm framework based on suggestions from Max Kellerman o constify queue_iterate() o use list_del_init() and list_empty() to check if a node is in the list +o remove unix socket file on exit Max Kellermann <max@duempel.org>: diff --git a/include/local.h b/include/local.h index 350b8bf..aae73a7 100644 --- a/include/local.h +++ b/include/local.h @@ -15,7 +15,7 @@ struct local_conf { /* local server */ int local_server_create(struct local_conf *conf); -void local_server_destroy(int fd); +void local_server_destroy(int fd, const char *); int do_local_server_step(int fd, void *data, void (*process)(int fd, void *data)); diff --git a/src/local.c b/src/local.c index 9ff5f82..d861e12 100644 --- a/src/local.c +++ b/src/local.c @@ -37,6 +37,7 @@ int local_server_create(struct local_conf *conf) if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &conf->reuseaddr, sizeof(conf->reuseaddr)) == -1) { close(fd); + unlink(conf->path); return -1; } @@ -47,19 +48,22 @@ int local_server_create(struct local_conf *conf) if (bind(fd, (struct sockaddr *) &local, len) == -1) { close(fd); + unlink(conf->path); return -1; } if (listen(fd, conf->backlog) == -1) { close(fd); + unlink(conf->path); return -1; } return fd; } -void local_server_destroy(int fd) +void local_server_destroy(int fd, const char *path) { + unlink(path); close(fd); } @@ -43,7 +43,7 @@ void killer(int foo) nfct_close(STATE(dump)); ignore_pool_destroy(STATE(ignore_pool)); - local_server_destroy(STATE(local)); + local_server_destroy(STATE(local), CONFIG(local).path); STATE(mode)->kill(); unlink(CONFIG(lockfile)); dlog(STATE(log), LOG_NOTICE, "---- shutdown received ----"); |