提交 b80b3ce4 编写于 作者: J Jim Meyering

socketcompat.h: simplify, to match latest gnulib

Now, sys/socket.h is always available, and errno works.
上级 75e69df9
Tue Oct 28 12:12:41 +0100 2008 Jim Meyering <meyering@redhat.com>
socketcompat.h: simplify, to match latest gnulib
Now, sys/socket.h is always available, and errno works.
Tue Oct 28 12:07:46 +0100 2008 Jim Meyering <meyering@redhat.com> Tue Oct 28 12:07:46 +0100 2008 Jim Meyering <meyering@redhat.com>
updates from gnulib updates from gnulib
......
...@@ -24,14 +24,7 @@ ...@@ -24,14 +24,7 @@
#include <config.h> #include <config.h>
#include <errno.h> #include <errno.h>
#ifndef HAVE_WINSOCK2_H /* Unix & Cygwin. */
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
static inline int static inline int
socket_errno (void) socket_errno (void)
...@@ -39,23 +32,11 @@ socket_errno (void) ...@@ -39,23 +32,11 @@ socket_errno (void)
return errno; return errno;
} }
#else /* MinGW & Win32 */ #ifndef HAVE_WINSOCK2_H /* Unix & Cygwin. */
# include <sys/un.h>
#include <winsock2.h> # include <net/if.h>
# include <netinet/in.h>
/* Socket functions in Windows don't set errno. Instead of using errno # include <netinet/tcp.h>
* 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
#endif /* HAVE_WINSOCK2_H */ #endif /* HAVE_WINSOCK2_H */
#endif /* __WINSOCKWRAPPER_H__ */ #endif /* __WINSOCKWRAPPER_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册