From 7658924ee018a2b155fa5f72a48486310e20d7ac Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Mon, 23 Dec 2019 12:42:10 +0300
Subject: Haiku build fix


diff --git a/upnp/src/api/upnpapi.c b/upnp/src/api/upnpapi.c
index 9ddc7fb..5688ba8 100644
--- a/upnp/src/api/upnpapi.c
+++ b/upnp/src/api/upnpapi.c
@@ -3532,6 +3532,10 @@ int UpnpGetIfInfo(const char *IfName)
 	inet_ntop(AF_INET, &v4_addr, gIF_IPV4, sizeof(gIF_IPV4));
 	inet_ntop(AF_INET6, &v6_addr, gIF_IPV6, sizeof(gIF_IPV6));
 	gIF_INDEX = if_nametoindex(gIF_NAME);
+#elif defined(__HAIKU__)
+	UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
+		   "failed to find list of addresses\n");
+	return UPNP_E_INIT;
 #else /* (defined(BSD) && BSD >= 199306) || defined(__FreeBSD_kernel__) */ /* _WIN32 */
 	struct ifreq ifArray[MAX_INTERFACES];
 	struct ifconf ifConf;
@@ -4026,6 +4030,10 @@ int getlocalhostname(char *out, size_t out_len)
 	freeifaddrs(ifap);
 
 	ret = ifa ? UPNP_E_SUCCESS : UPNP_E_INIT;
+#elif defined(__HAIKU__)
+	UpnpPrintf(UPNP_CRITICAL, API, __FILE__, __LINE__,
+		   "failed to find list of addresses\n");
+	return UPNP_E_INIT;
 #else
 	struct ifreq ifArray[MAX_INTERFACES];
 	struct ifconf ifConf;
diff --git a/upnp/src/threadutil/ThreadPool.c b/upnp/src/threadutil/ThreadPool.c
index 2441d38..56c6284 100644
--- a/upnp/src/threadutil/ThreadPool.c
+++ b/upnp/src/threadutil/ThreadPool.c
@@ -419,7 +419,7 @@ static void SetSeed(void)
 	srand((unsigned int)t.tv_usec + (unsigned int)ithread_get_current_thread_id().p);
 #elif defined(BSD) || defined(__OSX__) || defined(__APPLE__) || defined(__FreeBSD_kernel__)
 	srand((unsigned int)t.tv_usec + (unsigned int)ithread_get_current_thread_id());
-#elif defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || defined(__GLIBC__)
+#elif defined(__linux__) || defined(__sun) || defined(__CYGWIN__) || defined(__GLIBC__) || defined(__HAIKU__)
 	srand((unsigned int)t.tv_usec + (unsigned int)ithread_get_current_thread_id());
 #else
 	{
-- 
2.24.1

