summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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
commit5b4129a89e9fa3ea3b5d57fc362f682aa85abfc7 (patch)
tree88fabdc48246ff409c8349d43fac04f5fca1b02b
parent588abed2a7df4fa1723475e41399876f3ee34250 (diff)
remove unix socket file on exit
-rw-r--r--ChangeLog1
-rw-r--r--include/local.h2
-rw-r--r--src/local.c6
-rw-r--r--src/run.c2
4 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6256ee6..75ead6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
}
diff --git a/src/run.c b/src/run.c
index 3fd98cd..cb5116d 100644
--- a/src/run.c
+++ b/src/run.c
@@ -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 ----");