From 8ca960fa0274018cb4f94a1826029d74e6f762e0 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 21 Jun 2021 20:24:03 +0200 Subject: lib, ipcpd, irmd: Wrap pthread unlocks for cleanup This add an ouroboros/pthread.h header that wraps the pthread_..._unlock() functions for cleanup using pthread_cleanup_push() as this casting is not safe (and there were definitely bad casts in the code). The close() function is now also wrapped for cleanup in ouroboros/sockets.h. This allows enabling more compiler checks. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/ipcpd/unicast/fa.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/ipcpd/unicast/fa.c') diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c index b3b9b42c..3ebdc1f1 100644 --- a/src/ipcpd/unicast/fa.c +++ b/src/ipcpd/unicast/fa.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "dir.h" #include "fa.h" @@ -47,7 +48,6 @@ #include "ca.h" #include -#include #include #include @@ -442,8 +442,7 @@ static void * fa_handle_packet(void * o) pthread_mutex_lock(&fa.mtx); - pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, - &fa.mtx); + pthread_cleanup_push(__cleanup_mutex_unlock, &fa.mtx); while (list_is_empty(&fa.cmds)) pthread_cond_wait(&fa.cond, &fa.mtx); -- cgit v1.2.3