aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-01-02 14:58:00 +0000
committermarha <marha@users.sourceforge.net>2010-01-02 14:58:00 +0000
commite990b127f48882996bc24094cc4fad49d343bfe5 (patch)
tree5094c4a1556a2fcf0b97c91def10bf6c410a5113
parent66ef07b684165a09f21069ad7fc3b1105cdb4e10 (diff)
downloadvcxsrv-e990b127f48882996bc24094cc4fad49d343bfe5.tar.gz
vcxsrv-e990b127f48882996bc24094cc4fad49d343bfe5.tar.bz2
vcxsrv-e990b127f48882996bc24094cc4fad49d343bfe5.zip
Use InitWSA function to intialise winsock.
-rw-r--r--libxcb/src/xcb_util.c29
-rw-r--r--xorg-server/dix/main.c6
2 files changed, 25 insertions, 10 deletions
diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c
index 2d23842d7..2980cb8d0 100644
--- a/libxcb/src/xcb_util.c
+++ b/libxcb/src/xcb_util.c
@@ -221,6 +221,23 @@ static int _xcb_open_decnet(const char *host, const char *protocol, const unsign
}
#endif
+#ifdef WIN32
+int InitWSA(void)
+{
+ static WSADATA wsadata;
+
+ if (!wsadata.wVersion)
+ {
+ ptw32_processInitialize();
+ if (WSAStartup(0x0202, &wsadata))
+ return -1;
+ }
+ return 0;
+}
+#else
+#define InitWSA()
+#endif
+
static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port)
{
int fd = -1;
@@ -254,16 +271,8 @@ static int _xcb_open_tcp(char *host, char *protocol, const unsigned short port)
#endif
#ifdef WIN32
- {
- static WSADATA wsadata;
-
- if (!wsadata.wVersion)
- {
- if (WSAStartup(0x0202, &wsadata))
- return -1;
- ptw32_processInitialize();
- }
- }
+ if (InitWSA()<0)
+ return -1;
#endif
snprintf(service, sizeof(service), "%hu", port);
diff --git a/xorg-server/dix/main.c b/xorg-server/dix/main.c
index 644f05b25..78cf716d2 100644
--- a/xorg-server/dix/main.c
+++ b/xorg-server/dix/main.c
@@ -156,6 +156,12 @@ int main(int argc, char *argv[], char *envp[])
display = "0";
#ifdef WIN32
+
+ if (InitWSA()<0)
+ {
+ printf("Error initialising WSA\n");
+ return -1;
+ }
/* In Win32 we have different threads call Xlib functions (depending
on the commandline options given).
XInitThreads has to be called before