From c9cffcf863b23e75ccb6d7800ac0d48fd1612259 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 4 Aug 2016 11:24:24 +0200 Subject: ipcpd: Fix incorrect cleanup of fd The cleanup was trying to close a pointer to the file descriptor. --- src/ipcpd/ipcp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ipcpd') 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; } -- cgit v1.2.3