vcpkg/ports/xcb/win-fixes.patch
Alexander Neumann 6f7ffeb18f
[many ports] Add X windows part 11/N (#27441)
* [libice] replace macros with typedefs

* [libx11] fix dl linkage on linux and cleanup the cmake wrapper.

* [libxxf86vm] add port

* [libxtst] add port

* [libxt] add port

* [libxmu] add port

* [libxaw] add port

* bump port version

* v db

* fix libxpm and maybe cross libxt

* malloc returns null for cross builds

* fix typo

* fix stuff

* v db

* fix stuff ?

* WIP commit

* libxt cross fix

* add todo

* fix libxaw

* xcb add some fixes.

* fix todos

* fix arm ?

* fix path

* bump some versions

* shorten comment

* format manifest

* v db

* fix stuff

* ci baseline

* v db

* adjust libx11 wrapper again

* v db

* add license

* remove doubled entry from v db

* v db

* libxmu remove global variable.

* correctly split unistd.patch and apply it

* disable thread safe init in libx11 on windows

* v db

* libx11 append options correctly.

* v db

* still not correct.

* v db
2022-11-11 17:32:25 -08:00

41 lines
1.2 KiB
Diff

diff --git a/src/xcb_util.c b/src/xcb_util.c
index 0296ce0dd..cce54aa50 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -389,7 +389,11 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
fd = _xcb_socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
if (_xcb_do_connect(fd, addr->ai_addr, addr->ai_addrlen) >= 0)
break;
+#ifdef _WIN32
+ closesocket(fd);
+#else
close(fd);
+#endif
fd = -1;
}
freeaddrinfo(results);
@@ -454,7 +458,11 @@ static int _xcb_open_unix(char *protocol, const char *file)
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(int));
}
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
+#ifdef _WIN32
+ closesocket(fd);
+#else
close(fd);
+#endif
return -1;
}
return fd;
@@ -481,7 +489,11 @@ static int _xcb_open_abstract(char *protocol, const char *file, size_t filelen)
if (fd == -1)
return -1;
if (connect(fd, (struct sockaddr *) &addr, namelen) == -1) {
+#ifdef _WIN32
+ closesocket(fd);
+#else
close(fd);
+#endif
return -1;
}
return fd;