From d44855c2d057d086126d575140d70563b956fbfa Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 21 Mar 2019 13:17:22 +0100
Subject: import previous patch


diff --git a/src/redirect.c b/src/redirect.c
index 6749a86..6d79b1a 100644
--- a/src/redirect.c
+++ b/src/redirect.c
@@ -20,7 +20,11 @@
 #include <unistd.h>
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
+#ifndef __HAIKU__
 #include <sys/signal.h>
+#else
+#include <signal.h>
+#endif
 
 #include "redirect.h"
 #include "service.h"
diff --git a/src/server.h b/src/server.h
index 43b282a..44fee7b 100644
--- a/src/server.h
+++ b/src/server.h
@@ -24,6 +24,9 @@
 typedef int pid_t ;
 #endif
 
+#ifndef FNDELAY
+#define FNDELAY O_NONBLOCK
+#endif
 
 /*
  * This struct describes running servers
diff --git a/src/signals.h b/src/signals.h
index 6acf97c..3aaf0b8 100644
--- a/src/signals.h
+++ b/src/signals.h
@@ -6,6 +6,10 @@
 #ifndef _X_SIGNALS
 #define _X_SIGNALS
 
+#ifndef SIGIOT
+#define SIGIOT SIGABRT
+#endif
+
 #include "defs.h"
 
 #if defined(NO_POSIX_SIGS)
diff --git a/src/sio/sio.c b/src/sio/sio.c
index c9abde9..464c2c9 100644
--- a/src/sio/sio.c
+++ b/src/sio/sio.c
@@ -10,7 +10,7 @@
 #include <sys/types.h>
 #endif
 
-#ifdef _APPLE_
+#if defined _APPLE_ || defined __HAIKU__
 #undef HAVE_MMAP
 #endif
 
diff --git a/src/sio/siosup.c b/src/sio/siosup.c
index 149bf57..1c9dc90 100644
--- a/src/sio/siosup.c
+++ b/src/sio/siosup.c
@@ -13,7 +13,7 @@
 #include <unistd.h>
 #include <syslog.h>
 
-#ifdef _APPLE_
+#if defined _APPLE_ || defined __HAIKU__
 #undef HAVE_MMAP
 #endif
 
diff --git a/src/util.c b/src/util.c
index 6ee97b9..8665098 100644
--- a/src/util.c
+++ b/src/util.c
@@ -16,7 +16,7 @@
  * The following ifdef is for TIOCNOTTY
  */
 #ifndef NO_TERMIOS
-#include <sys/termios.h>
+//#include <sys/termios.h>
 #include <termios.h>
 #else
 #include <sys/ioctl.h>
diff --git a/src/util.h b/src/util.h
index f46563d..d94730d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -4,6 +4,10 @@
 #include "pset.h"
 #include "defs.h"
 
+#ifndef FNDELAY
+#define FNDELAY O_NONBLOCK
+#endif
+
 void out_of_memory(const char *func);
 const struct name_value *nv_find_value(const struct name_value nv_array[],const char *name);
 const struct name_value *nv_find_name(const struct name_value nv_array[],int value);
-- 
2.19.1


From 22cab2f0716f8316fe39ea0dfa6981e032d62480 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 21 Mar 2019 13:21:04 +0100
Subject: xinetd needs to link to -lnetwork


diff --git a/configure.ac b/configure.ac
index 2e0cf21..164df7a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,11 @@ AC_FUNC_MMAP
 AC_CHECK_HEADER(sys/filio.h, [AC_DEFINE([HAVE_SYS_FILIO_H], [1], [Have FreeBSD filio.h])])
 AC_CHECK_FUNC(poll, [AC_DEFINE([HAVE_POLL], [1], [Have available poll function])])
 
+# ======================================
+# Check for various libraries for gethostbyname
+# ======================================
+AC_SEARCH_LIBS(gethostbyname, nsl socket resolv network)
+
 # ======
 # Switch
 # ======
-- 
2.19.1

