Author: dreid Date: Fri Dec 10 07:37:36 2004 New Revision: 111513 URL: http://svn.apache.org/viewcvs?view=rev&rev=111513 Log: Create the correct type of socket when using BeOS R5 with the old net_server code.
Contributed by: Ingo Weinhold <bonefish at cs dot tu-berlin dot de> Reviewed by: David Reid Modified: apr/apr/trunk/network_io/unix/sockets.c Modified: apr/apr/trunk/network_io/unix/sockets.c Url: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/unix/sockets.c?view=diff&rev=111513&p1=apr/apr/trunk/network_io/unix/sockets.c&r1=111512&p2=apr/apr/trunk/network_io/unix/sockets.c&r2=111513 ============================================================================== --- apr/apr/trunk/network_io/unix/sockets.c (original) +++ apr/apr/trunk/network_io/unix/sockets.c Fri Dec 10 07:37:36 2004 @@ -20,9 +20,10 @@ #include "apr_portable.h" #include "apr_arch_inherit.h" -#if defined(BEOS) && !defined(BEOS_BONE) +#ifdef BEOS_R5 +#undef close #define close closesocket -#endif +#endif /* BEOS_R5 */ static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */ @@ -92,7 +93,28 @@ alloc_socket(new, cont); +#ifndef BEOS_R5 (*new)->socketdes = socket(family, type, protocol); +#else + /* For some reason BeOS R5 has an unconventional protocol numbering, + * so we need to translate here. */ + switch (protocol) { + case 0: + (*new)->socketdes = socket(family, type, 0); + break; + case APR_PROTO_TCP: + (*new)->socketdes = socket(family, type, IPPROTO_TCP); + break; + case APR_PROTO_UDP: + (*new)->socketdes = socket(family, type, IPPROTO_UDP); + break; + case APR_PROTO_SCTP: + default: + errno = EPROTONOSUPPORT; + (*new)->socketdes = -1; + break; + } +#endif /* BEOS_R5 */ #if APR_HAVE_IPV6 if ((*new)->socketdes < 0 && ofamily == APR_UNSPEC) {
