| Use POSIX HOST_NAME_MAX, which is cleaner. - geomyidae - A small C-based gopher… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit 3328e3e0954e74d3397246b26a0fcbccc9567e4e | |
| parent d878002edce4e4a731a4936011e045f162d5c967 | |
| Author: Christoph Lohmann <[email protected]> | |
| 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(-) | |
| --- | |
| 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; |