summaryrefslogtreecommitdiff
path: root/src/local.c
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 /src/local.c
parent588abed2a7df4fa1723475e41399876f3ee34250 (diff)
downloadconntrack-tools-5b4129a89e9fa3ea3b5d57fc362f682aa85abfc7.tar.gz
conntrack-tools-5b4129a89e9fa3ea3b5d57fc362f682aa85abfc7.zip
remove unix socket file on exit
Diffstat (limited to 'src/local.c')
-rw-r--r--src/local.c6
1 files changed, 5 insertions, 1 deletions
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);
}