]> git.meshlink.io Git - utcp/commitdiff
Ensure utcp_close() works properly on a socket that is in the CLOSED state.
authorGuus Sliepen <guus@meshlink.io>
Fri, 30 Oct 2015 22:16:47 +0000 (23:16 +0100)
committerGuus Sliepen <guus@sliepen.org>
Sun, 2 Jul 2017 10:14:04 +0000 (12:14 +0200)
utcp.c

diff --git a/utcp.c b/utcp.c
index f2354b1b8d181fd103edcfff3b7b4c7bbf44b9ec..026fb31bf340f74db204ab1f68ad6cfe27c4977c 100644 (file)
--- a/utcp.c
+++ b/utcp.c
@@ -1294,7 +1294,7 @@ int utcp_shutdown(struct utcp_connection *c, int dir) {
 }
 
 int utcp_close(struct utcp_connection *c) {
-       if(utcp_shutdown(c, SHUT_RDWR))
+       if(utcp_shutdown(c, SHUT_RDWR) && errno != ENOTCONN)
                return -1;
        c->recv = NULL;
        c->poll = NULL;