commit db198578c65f715272229b4a5657faf9e32b704e
parent 9217fb0bd83a6133c0e15d4cc9beac9fc50ea307
Author: Joris Vink <joris@coders.se>
Date: Sun, 14 Jun 2015 16:54:44 +0200
Allow Kore to function under DragonflyBSD.
From David Carlier
Diffstat:
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/cli.c b/src/cli.c
@@ -40,7 +40,8 @@
#include "kore.h"
-#if defined(OpenBSD) || defined(__FreeBSD_version) || defined(NetBSD)
+#if defined(OpenBSD) || defined(__FreeBSD_version) || \
+ defined(NetBSD) || defined(__DragonFly__version)
#define PRI_TIME_T "d"
#endif
diff --git a/src/kore.c b/src/kore.c
@@ -229,11 +229,17 @@ kore_server_bind(const char *ip, const char *port)
{
struct listener *l;
int on, r;
- struct addrinfo *results;
+ struct addrinfo hints, *results;
kore_debug("kore_server_bind(%s, %s)", ip, port);
- r = getaddrinfo(ip, port, NULL, &results);
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = IPPROTO_TCP;
+ hints.ai_flags = 0;
+
+ r = getaddrinfo(ip, port, &hints, &results);
if (r != 0)
fatal("getaddrinfo(%s): %s", ip, gai_strerror(r));