diff options
author | dimitri staessens <[email protected]> | 2017-10-11 15:28:43 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-10-11 15:28:43 +0200 |
commit | a483bc8597e5c19e796dc55c0587f1a045bc7281 (patch) | |
tree | f27b6f1f7519855010f6faab9b2d9305b1b0f63a /src/ipcpd/shim-eth-llc/main.c | |
parent | 281eaf854247703ed36725ab9dbef3a11d860c5c (diff) | |
download | ouroboros-a483bc8597e5c19e796dc55c0587f1a045bc7281.tar.gz ouroboros-a483bc8597e5c19e796dc55c0587f1a045bc7281.zip |
ipcpd: Fix unreachable code in shim-eth-llc
Closing the file descriptor after a while(true) loop led to clang
compiler errors. This is fixed by adding a cleanup handler.
Diffstat (limited to 'src/ipcpd/shim-eth-llc/main.c')
-rw-r--r-- | src/ipcpd/shim-eth-llc/main.c | 10 |
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(ð_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; } |