]> git.meshlink.io Git - utcp/blobdiff - utcp.c
Ensure utcp_close() works properly on a socket that is in the CLOSED state.
[utcp] / 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;