diff options
Diffstat (limited to 'plugins/dhcp.c')
-rw-r--r-- | plugins/dhcp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/dhcp.c b/plugins/dhcp.c index b07a7113..1e6b83d7 100644 --- a/plugins/dhcp.c +++ b/plugins/dhcp.c @@ -111,6 +111,7 @@ static int dhcp_request(struct connman_dhcp *dhcp) { GDHCPClient *dhcp_client; GDHCPClientError error; + const char *hostname; int index; DBG("dhcp %p", dhcp); @@ -124,8 +125,9 @@ static int dhcp_request(struct connman_dhcp *dhcp) if (getenv("CONNMAN_DHCP_DEBUG")) g_dhcp_client_set_debug(dhcp_client, dhcp_debug, "DHCP"); - g_dhcp_client_set_send(dhcp_client, G_DHCP_HOST_NAME, - connman_utsname_get_hostname()); + hostname = connman_utsname_get_hostname(); + if (hostname != NULL) + g_dhcp_client_set_send(dhcp_client, G_DHCP_HOST_NAME, hostname); g_dhcp_client_set_request(dhcp_client, G_DHCP_HOST_NAME); g_dhcp_client_set_request(dhcp_client, G_DHCP_SUBNET); |