diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c index 6198b4449..c9c454f9c 100644 --- a/netutils/dhcpc/dhcpc.c +++ b/netutils/dhcpc/dhcpc.c @@ -244,7 +244,7 @@ static int dhcpc_sendmsg(FAR struct dhcpc_state_s *pdhcpc, /* Get the current host name */ - if (gethostname(hostname, sizeof(hostname))) + if (gethostname(hostname, sizeof(hostname)) || (0 == strlen(hostname))) { strncpy(hostname, CONFIG_NETUTILS_DHCPC_HOST_NAME, HOST_NAME_MAX); }