summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-eth-llc/main.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-10-14 08:28:47 +0000
committerSander Vrijders <[email protected]>2017-10-14 08:28:47 +0000
commit76ce1f398a6efae7f62b6e786ef94e89be0784c1 (patch)
treef27b6f1f7519855010f6faab9b2d9305b1b0f63a /src/ipcpd/shim-eth-llc/main.c
parent281eaf854247703ed36725ab9dbef3a11d860c5c (diff)
parenta483bc8597e5c19e796dc55c0587f1a045bc7281 (diff)
downloadouroboros-76ce1f398a6efae7f62b6e786ef94e89be0784c1.tar.gz
ouroboros-76ce1f398a6efae7f62b6e786ef94e89be0784c1.zip
Merged in dstaesse/ouroboros/be-shim-eth-clang (pull request #625)
ipcpd: Fix unreachable code in shim-eth-llc
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;
}