summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2014-08-18 23:02:54 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2014-08-18 23:02:54 +0200
commit9fab2fd2bdf8c17b8cda9479cabd48a2618adeb7 (patch)
tree5716a67b86554ad9d3245c7032726ec7f4f9d4e8
parent371cd5ea215992152a8226d42f2ed41471535d7f (diff)
downloadxK-9fab2fd2bdf8c17b8cda9479cabd48a2618adeb7.tar.gz
xK-9fab2fd2bdf8c17b8cda9479cabd48a2618adeb7.tar.xz
xK-9fab2fd2bdf8c17b8cda9479cabd48a2618adeb7.zip
kike: don't use HOST_NAME_MAX
FreeBSD doesn't have it.
-rw-r--r--kike.c6
1 files changed, 5 insertions, 1 deletions
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",