summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-09-30 09:15:55 +0200
committerGravatar Christian Hesse <mail@eworm.de>2016-09-30 09:15:55 +0200
commite86c874dbf0f88798688b5d7244e133c13e4a535 (patch)
tree01efb0c75707728f533ba6c4172d0f042f243ee3
parent1e52ef295cff61cbc2dae72dbe3e409a66c0b302 (diff)
downloaddyndhcpd-e86c874dbf0f88798688b5d7244e133c13e4a535.tar.gz
dyndhcpd-e86c874dbf0f88798688b5d7244e133c13e4a535.tar.zst
use HOST_NAME_MAX from limits.h
-rw-r--r--dyndhcpd.c4
-rw-r--r--dyndhcpd.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/dyndhcpd.c b/dyndhcpd.c
index 134e845..135a018 100644
--- a/dyndhcpd.c
+++ b/dyndhcpd.c
@@ -41,7 +41,7 @@ int main(int argc, char ** argv) {
struct network network, dhcp, bootp;
char * interface = NULL;
- char hostname[254];
+ char hostname[HOST_NAME_MAX];
char * domainname;
struct hostent *hp;
@@ -108,7 +108,7 @@ int main(int argc, char ** argv) {
}
/* get the domainname */
- gethostname(hostname, 254);
+ gethostname(hostname, HOST_NAME_MAX);
hp = gethostbyname(hostname);
if ((domainname = strchr(hp->h_name, '.')) != NULL)
domainname++;
diff --git a/dyndhcpd.h b/dyndhcpd.h
index cbcffb2..9a84b55 100644
--- a/dyndhcpd.h
+++ b/dyndhcpd.h
@@ -14,6 +14,7 @@
#include <sys/socket.h>
#include <net/if.h>
#include <netdb.h>
+#include <limits.h>
#include <ifaddrs.h>
#include <stdio.h>
#include <stdlib.h>