socketcompat.h: simplify, to match latest gnulib

Now, sys/socket.h is always available, and errno works.
This commit is contained in:
Jim Meyering 2008-10-28 17:47:23 +00:00
parent 75e69df956
commit b80b3ce4b3
2 changed files with 10 additions and 24 deletions

View File

@ -1,3 +1,8 @@
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>
updates from gnulib

View File

@ -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__ */