This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push: new e8a353a netutils: dhcpc: Fix dhcpc.c e8a353a is described below commit e8a353af056895e8fececc1a091f20441fd76079 Author: Masayuki Ishikawa <masayuki.ishik...@gmail.com> AuthorDate: Sun Sep 20 23:08:47 2020 +0900 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.ishik...@jp.sony.com> --- netutils/dhcpc/dhcpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netutils/dhcpc/dhcpc.c b/netutils/dhcpc/dhcpc.c index 6198b44..c9c454f 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); }