netutils: dhcpc: Fix dhcpc.c
Summary: - dhcpc now uses gethostname() but the hostname might be empty - This commit fixes this issue Impact: - All use cases which use dhcpc Testing: - Tested with spresense:wifi Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
d635fcb2d8
commit
e8a353af05
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user