summaryrefslogtreecommitdiff
path: root/kike.c
diff options
context:
space:
mode:
Diffstat (limited to 'kike.c')
-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",