[PATCH 20/23] src: replace WSAStartup with g_networking_init()

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

 



g_networking_init() does the same as our custom code.

Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 m4/virt-glib.m4 |  2 +-
 src/libvirt.c   | 25 ++-----------------------
 2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/m4/virt-glib.m4 b/m4/virt-glib.m4
index eb2c77b25b..03e51711c0 100644
--- a/m4/virt-glib.m4
+++ b/m4/virt-glib.m4
@@ -24,7 +24,7 @@ AC_DEFUN([LIBVIRT_ARG_GLIB], [
 AC_DEFUN([LIBVIRT_CHECK_GLIB],[
   GLIB_REQUIRED=2.48.0
 
-  LIBVIRT_CHECK_PKG([GLIB], [glib-2.0 gobject-2.0], [$GLIB_REQUIRED])
+  LIBVIRT_CHECK_PKG([GLIB], [glib-2.0 gobject-2.0 gio-2.0], [$GLIB_REQUIRED])
 
   if test "$with_glib" = "no" ; then
     AC_MSG_ERROR([glib-2.0, gobject-2.0 >= $GLIB_REQUIRED are required for libvirt])
diff --git a/src/libvirt.c b/src/libvirt.c
index c741ebe311..f1ffc97261 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -26,15 +26,12 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <time.h>
+#include <gio/gnetworking.h>
 
 #include <libxml/parser.h>
 #include <libxml/xpath.h>
 #include "getpass.h"
 
-#ifdef HAVE_WINSOCK2_H
-# include <winsock2.h>
-#endif
-
 #ifdef WITH_CURL
 # include <curl/curl.h>
 #endif
@@ -211,21 +208,6 @@ static virConnectAuth virConnectAuthDefault = {
  */
 virConnectAuthPtr virConnectAuthPtrDefault = &virConnectAuthDefault;
 
-#if HAVE_WINSOCK2_H
-static int
-virWinsockInit(void)
-{
-    WORD winsock_version, err;
-    WSADATA winsock_data;
-
-    /* http://msdn2.microsoft.com/en-us/library/ms742213.aspx */
-    winsock_version = MAKEWORD(2, 2);
-    err = WSAStartup(winsock_version, &winsock_data);
-    return err == 0 ? 0 : -1;
-}
-#endif
-
-
 static bool virGlobalError;
 static virOnceControl virGlobalOnce = VIR_ONCE_CONTROL_INITIALIZER;
 
@@ -261,10 +243,7 @@ virGlobalInit(void)
 
     VIR_DEBUG("register drivers");
 
-#if HAVE_WINSOCK2_H
-    if (virWinsockInit() == -1)
-        goto error;
-#endif
+    g_networking_init();
 
 #ifdef HAVE_LIBINTL_H
     if (!bindtextdomain(PACKAGE, LOCALEDIR))
-- 
2.24.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux