commit 3328e3e0954e74d3397246b26a0fcbccc9567e4e
parent d878002edce4e4a731a4936011e045f162d5c967
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:
1 file changed, 3 insertions(+), 2 deletions(-)
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;