[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libvir] 12/22 Winsock init



Stupid Microsoft cruft and pollution. Winsock needs to be initialised before use!

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.108
diff -u -r1.108 libvirt.c
--- src/libvirt.c	5 Dec 2007 18:55:04 -0000	1.108
+++ src/libvirt.c	7 Dec 2007 10:53:28 -0000
@@ -24,6 +24,10 @@
 #include <libxml/xpath.h>
 #include <libxml/uri.h>
 
+#if HAVE_WINSOCK2_H
+#include <winsock2.h>
+#endif
+
 #include "internal.h"
 #include "driver.h"
 
@@ -156,11 +160,24 @@
 int
 virInitialize(void)
 {
+#if HAVE_WINSOCK2_H
+    WORD winsock_version, err;
+    WSADATA winsock_data;
+#endif
+
     DEBUG0;
     if (initialized)
         return(0);
     initialized = 1;
 
+#if HAVE_WINSOCK2_H
+    /* http://msdn2.microsoft.com/en-us/library/ms742213.aspx */
+    winsock_version = MAKEWORD (2, 2);
+    err = WSAStartup (winsock_version, &winsock_data);
+    if (err != 0)
+        return -1;
+#endif
+
     if (!bindtextdomain(GETTEXT_PACKAGE, LOCALEBASEDIR))
         return (-1);
 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]