]> xenbits.xensource.com Git - libvirt.git/commitdiff
winsock2.h must always be included before windows.h
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 21 Jun 2012 13:37:34 +0000 (14:37 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 25 Jun 2012 09:41:10 +0000 (10:41 +0100)
Some GNULIB headers (eg unistd.h) will often need to include
winsock2.h for various symbols. There is a rule that winsock2.h
must be included before windows.h. This means that any file
which does

  #ifdef WIN32
  #include <windows.h>
  #endif
  #include <unistd.h>

is potentially broken. A simple rule is that /all/ includes of
windows.h must be matched with a preceding include of winsock2.h
regardless of whether unistd.h is used currently

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/util/util.c
src/vbox/vbox_MSCOMGlue.c

index ce98d206d64a94123ca2d53df2d9eab3edd51b7e..f886ea700769ddc1623b608cc45749f964f81aee 100644 (file)
@@ -65,6 +65,9 @@
 #endif
 
 #ifdef WIN32
+# ifdef HAVE_WINSOCK2_H
+#  include <winsock2.h>
+# endif
 # include <windows.h>
 # include <shlobj.h>
 #endif
index b07d6a7ed8e1d3f9cdd8edc29d18eb8e8025f41d..68810fbf7791b65fd8a9caab6e764adb9c03ba5f 100644 (file)
@@ -22,6 +22,9 @@
 
 #include <config.h>
 
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
 #include <windows.h>
 
 #define nsCID CLSID