diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-04 11:24:24 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-04 17:17:49 +0200 |
commit | c9cffcf863b23e75ccb6d7800ac0d48fd1612259 (patch) | |
tree | b117fa94d30ddbce03f7927a59e761e4b6f356e8 | |
parent | 4931526cf9b5e40294e043deab856f25bf56c7cf (diff) | |
download | ouroboros-c9cffcf863b23e75ccb6d7800ac0d48fd1612259.tar.gz ouroboros-c9cffcf863b23e75ccb6d7800ac0d48fd1612259.zip |
ipcpd: Fix incorrect cleanup of fd
The cleanup was trying to close a pointer to the file descriptor.
-rw-r--r-- | src/ipcpd/ipcp.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index fb31cf1b..8fed60eb 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -86,6 +86,11 @@ int ipcp_parse_arg(int argc, char * argv[]) return 0; } +static void close_ptr(void * o) +{ + close(*((int *) o)); +} + void * ipcp_main_loop(void * o) { int lsockfd; @@ -118,7 +123,7 @@ void * ipcp_main_loop(void * o) return (void *) 1; } - pthread_cleanup_push((void(*)(void *)) close, + pthread_cleanup_push(close_ptr, (void *) &sockfd); free(sock_path); @@ -268,7 +273,7 @@ void * ipcp_main_loop(void * o) close(lsockfd); } - pthread_cleanup_pop(0); + pthread_cleanup_pop(false); return NULL; } |