summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2004-12-10 15:37:36 +0000
committerdreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2004-12-10 15:37:36 +0000
commit78a89580845347749474785bca1b5e1180d0f7ef (patch)
treeb9cb16f6edcf26ad07b995160d6cca6c09dfb292
parente4d07a79ce5262fd9386ceae25178758846d444d (diff)
downloadlibapr-78a89580845347749474785bca1b5e1180d0f7ef.tar.gz
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 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@111513 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--network_io/unix/sockets.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c
index d843fdf88..ed9616801 100644
--- a/network_io/unix/sockets.c
+++ b/network_io/unix/sockets.c
@@ -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 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type,
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) {