lib: Fix unix socket use on Windows

Closes #3521. Thanks to lt-havoc
This commit is contained in:
Roger A. Light
2026-02-24 14:58:34 +00:00
parent ae19460c13
commit e57342e7ac

View File

@@ -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;
}