Use POSIX HOST_NAME_MAX, which is cleaner. - geomyidae - A small C-based gopherd. (HTM) git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ (DIR) Log (DIR) Files (DIR) Refs (DIR) Tags (DIR) README (DIR) LICENSE --- (DIR) commit 3328e3e0954e74d3397246b26a0fcbccc9567e4e (DIR) parent d878002edce4e4a731a4936011e045f162d5c967 (HTM) Author: Christoph Lohmann <20h@r-36.net> Date: Tue, 30 Oct 2018 20:48:04 +0100 Use POSIX HOST_NAME_MAX, which is cleaner. Diffstat: M main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- (DIR) diff --git a/main.c b/main.c @@ -23,6 +23,7 @@ #include <grp.h> #include <errno.h> #include <arpa/inet.h> +#include <limits.h> #include "ind.h" #include "handlr.h" @@ -455,8 +456,8 @@ main(int argc, char *argv[]) usage(); if (ohost == NULL) { - ohost = xcalloc(1, 513); - if (gethostname(ohost, 512) < 0) { + ohost = xcalloc(1, HOST_NAME_MAX+1); + if (gethostname(ohost, HOST_NAME_MAX) < 0) { perror("gethostname"); free(ohost); return 1;