summaryrefslogtreecommitdiff
path: root/network_io/unix/sockets.c
diff options
context:
space:
mode:
authorDavid Reid <dreid@apache.org>2004-12-10 15:37:36 +0000
committerDavid Reid <dreid@apache.org>2004-12-10 15:37:36 +0000
commit209826554dccb9feb41731585a60d60b57dc9ccc (patch)
treeb9cb16f6edcf26ad07b995160d6cca6c09dfb292 /network_io/unix/sockets.c
parentcf69415e3073da2a7c19a5e3e2e527c99277c308 (diff)
downloadapr-209826554dccb9feb41731585a60d60b57dc9ccc.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: https://svn.apache.org/repos/asf/apr/apr/trunk@111513 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io/unix/sockets.c')
-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) {