Commit 64346620 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

ws2_32: Allow binding to IrDA sockets if IrDA support is compiled in.

parent 0ce420de
...@@ -110,6 +110,14 @@ ...@@ -110,6 +110,14 @@
# define HAVE_IPX # define HAVE_IPX
#endif #endif
#ifdef HAVE_LINUX_IRDA_H
# ifdef HAVE_LINUX_TYPES_H
# include <linux/types.h>
# endif
# include <linux/irda.h>
# define HAVE_IRDA
#endif
#ifdef HAVE_POLL_H #ifdef HAVE_POLL_H
#include <poll.h> #include <poll.h>
#endif #endif
...@@ -852,11 +860,25 @@ static struct WS_protoent *check_buffer_pe(int size) ...@@ -852,11 +860,25 @@ static struct WS_protoent *check_buffer_pe(int size)
/* ----------------------------------- i/o APIs */ /* ----------------------------------- i/o APIs */
static inline BOOL supported_pf(int pf)
{
switch (pf)
{
case WS_AF_INET:
case WS_AF_INET6:
return TRUE;
#ifdef HAVE_IPX #ifdef HAVE_IPX
#define SUPPORTED_PF(pf) ((pf)==WS_AF_INET || (pf)== WS_AF_IPX || (pf) == WS_AF_INET6) case WS_AF_IPX:
#else return TRUE;
#define SUPPORTED_PF(pf) ((pf)==WS_AF_INET || (pf) == WS_AF_INET6) #endif
#ifdef HAVE_IRDA
case WS_AF_IRDA:
return TRUE;
#endif #endif
default:
return FALSE;
}
}
/**********************************************************************/ /**********************************************************************/
...@@ -1425,7 +1447,7 @@ int WINAPI WS_bind(SOCKET s, const struct WS_sockaddr* name, int namelen) ...@@ -1425,7 +1447,7 @@ int WINAPI WS_bind(SOCKET s, const struct WS_sockaddr* name, int namelen)
if (fd != -1) if (fd != -1)
{ {
if (!name || (name->sa_family && !SUPPORTED_PF(name->sa_family))) if (!name || (name->sa_family && !supported_pf(name->sa_family)))
{ {
SetLastError(WSAEAFNOSUPPORT); SetLastError(WSAEAFNOSUPPORT);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment