[libvirt] [PATCH 08/17] socketcompat.h: simplify, to match latest gnulib

Jim Meyering jim at meyering.net
Tue Oct 28 11:21:25 UTC 2008


From: Jim Meyering <meyering at redhat.com>

Now, sys/socket.h is always available, and errno works.
---
 src/socketcompat.h |   29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/src/socketcompat.h b/src/socketcompat.h
index 51235f6..a06fe36 100644
--- a/src/socketcompat.h
+++ b/src/socketcompat.h
@@ -24,14 +24,7 @@
 #include <config.h>

 #include <errno.h>
-
-#ifndef HAVE_WINSOCK2_H		/* Unix & Cygwin. */
-
 #include <sys/socket.h>
-#include <sys/un.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>

 static inline int
 socket_errno (void)
@@ -39,23 +32,11 @@ socket_errno (void)
   return errno;
 }

-#else                           /* MinGW & Win32 */
-
-#include <winsock2.h>
-
-/* Socket functions in Windows don't set errno.  Instead of using errno
- * to test for socket errors, call this function to get the errno.
- */
-static inline int
-socket_errno (void)
-{
-  return WSAGetLastError ();
-}
-
-/* Compatibility. */
-#define EWOULDBLOCK             WSAEWOULDBLOCK
-#define ECONNREFUSED            WSAECONNREFUSED
-
+#ifndef HAVE_WINSOCK2_H		/* Unix & Cygwin. */
+# include <sys/un.h>
+# include <net/if.h>
+# include <netinet/in.h>
+# include <netinet/tcp.h>
 #endif /* HAVE_WINSOCK2_H */

 #endif /* __WINSOCKWRAPPER_H__ */
-- 
1.6.0.3.756.gb776d




More information about the libvir-list mailing list