From 9fab2fd2bdf8c17b8cda9479cabd48a2618adeb7 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Mon, 18 Aug 2014 23:02:54 +0200
Subject: kike: don't use HOST_NAME_MAX
FreeBSD doesn't have it.
---
kike.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kike.c b/kike.c
index d66b012..5d0b1e5 100644
--- a/kike.c
+++ b/kike.c
@@ -2890,7 +2890,11 @@ irc_initialize_server_name (struct server_context *ctx, struct error **e)
}
else
{
- char hostname[HOST_NAME_MAX];
+ long host_name_max = sysconf (_SC_HOST_NAME_MAX);
+ if (host_name_max <= 0)
+ host_name_max = _POSIX_HOST_NAME_MAX;
+
+ char hostname[host_name_max + 1];
if (gethostname (hostname, sizeof hostname))
{
error_set (e, "%s: %s",
--
cgit v1.2.3-70-g09d2