summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-22 16:13:57 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-22 16:25:39 +0200
commit82c6b3ed73b01321141488c634c9c1c4d515b04b (patch)
tree58e010a2cd69cf12d90748b7d9454c1ca6bf1c60
parentf99731a667b2ba5aa8ac7f1b331e03e7ad62e7c7 (diff)
downloadouroboros-82c6b3ed73b01321141488c634c9c1c4d515b04b.tar.gz
ouroboros-82c6b3ed73b01321141488c634c9c1c4d515b04b.zip
irmd, ipcp: Unlink file for UNIX sockets
-rw-r--r--src/ipcpd/ipcp.c6
-rw-r--r--src/irmd/main.c3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 4f3e6799..1c4fab94 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -103,7 +103,13 @@ int ipcp_parse_arg(int argc, char * argv[])
static void close_ptr(void * o)
{
+ char * name = ipcp_sock_path(getpid());
close(*((int *) o));
+
+ if (unlink(name))
+ LOG_DBG("Could not unlink %s.", name);
+
+ free(name);
}
static void clean_msg(void * msg)
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 06cf0e07..df93c75a 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1595,6 +1595,9 @@ static void irm_destroy()
close(irmd->sockfd);
+ if (unlink(IRM_SOCK_PATH))
+ LOG_DBG("Failed to unlink %s.", IRM_SOCK_PATH);
+
pthread_rwlock_unlock(&irmd->state_lock);
pthread_rwlock_destroy(&irmd->reg_lock);