diff --git a/lib/net_mosq.c b/lib/net_mosq.c index f7a233f1..b2a7d0d5 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -527,7 +527,7 @@ static int net__try_connect_tcp(const char *host, uint16_t port, mosq_sock_t *so static int net__try_connect_unix(const char *host, mosq_sock_t *sock) { struct sockaddr_un addr; - int s; + mosq_sock_t s; int rc; if(host == NULL || strlen(host) == 0 || strlen(host) > sizeof(addr.sun_path)-1){ @@ -551,7 +551,7 @@ static int net__try_connect_unix(const char *host, mosq_sock_t *sock) rc = connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)); if(rc < 0){ - close(s); + COMPAT_CLOSE(s); return MOSQ_ERR_ERRNO; }