summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-eth-llc/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/shim-eth-llc/main.c')
-rw-r--r--src/ipcpd/shim-eth-llc/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ipcpd/shim-eth-llc/main.c b/src/ipcpd/shim-eth-llc/main.c
index ca0c8166..52b111a5 100644
--- a/src/ipcpd/shim-eth-llc/main.c
+++ b/src/ipcpd/shim-eth-llc/main.c
@@ -821,6 +821,12 @@ static void change_flows_state(bool up)
pthread_rwlock_unlock(&eth_llc_data.flows_lock);
}
+static void close_ptr(void * o)
+{
+ close(*((int *) o));
+}
+
+
static void * eth_llc_ipcp_if_monitor(void * o)
{
int fd;
@@ -841,6 +847,8 @@ static void * eth_llc_ipcp_if_monitor(void * o)
return (void *) -1;
}
+ pthread_cleanup_push(close_ptr, &fd);
+
while (true) {
status = recvmsg(fd, &msg, 0);
if (status < 0)
@@ -878,7 +886,7 @@ static void * eth_llc_ipcp_if_monitor(void * o)
}
}
- close(fd);
+ pthread_cleanup_pop(true);
return (void *) 0;
}