1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

coverity: 37468: confirm gethostname worked

This commit is contained in:
Andy Green 2020-08-19 07:19:48 +01:00
parent d69b91d2d9
commit 258ee1886f

View file

@ -3071,8 +3071,10 @@ lws_server_get_canonical_hostname(struct lws_context *context,
return;
#if !defined(LWS_PLAT_FREERTOS)
/* find canonical hostname */
gethostname((char *)context->canonical_hostname,
sizeof(context->canonical_hostname) - 1);
if (gethostname((char *)context->canonical_hostname,
sizeof(context->canonical_hostname) - 1))
lws_strncpy((char *)context->canonical_hostname, "unknown",
sizeof(context->canonical_hostname));
lwsl_info(" canonical_hostname = %s\n", context->canonical_hostname);
#else