diff options
author | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-26 14:42:45 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@intec.ugent.be> | 2016-05-26 15:08:13 +0200 |
commit | c1dd73319e5bc80a158cb1c4cffae3c9a7b13a87 (patch) | |
tree | be92fa1c79329b17f131a055f3b93a92114ba1f0 | |
parent | 98f5a4cd845035a7fbeaa8ea95e58023c52e2b9c (diff) | |
download | ouroboros-c1dd73319e5bc80a158cb1c4cffae3c9a7b13a87.tar.gz ouroboros-c1dd73319e5bc80a158cb1c4cffae3c9a7b13a87.zip |
ipcpd: Cleanup handler for main message loop
This adds a cleanup handler for the main message loop, which closes
the socket upon pthread_cancel so that the ipcp can exit cleanly.
-rw-r--r-- | src/ipcpd/ipcp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index dd370005..e0dd1b60 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -93,6 +93,9 @@ void * ipcp_main_loop(void * o) return (void *) 1; } + pthread_cleanup_push((void(*)(void *)) close, + (void *) &sockfd); + free(sock_path); while (true) { @@ -259,5 +262,7 @@ void * ipcp_main_loop(void * o) close(lsockfd); } + pthread_cleanup_pop(0); + return NULL; } |