Commit 09f6e8a1 authored by Marcin Niestroj's avatar Marcin Niestroj Committed by Jukka Rissanen
Browse files

net: hostname: fix logging hostname string



Following errors occuring after enabling debug logs:

  log: argument 2 in source net_hostname log message "%s: (%s): \
    Hostname set to %s" missinglog_strdup().
  log: argument 2 in source net_hostname log message "%s: (%s): \
    New hostname %s" missinglog_strdup().

Fix that by printing CONFIG_NET_HOSTNAME directly in the first case and
using log_strdup() in the second.

Signed-off-by: default avatarMarcin Niestroj <m.niestroj@grinn-global.com>
parent 4d930057
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ int net_hostname_set_postfix(const uint8_t *hostname_postfix,
			 2 + 1, "%02x", hostname_postfix[i]);
	}

	NET_DBG("New hostname %s", hostname);
	NET_DBG("New hostname %s", log_strdup(hostname));

	postfix_set = true;

@@ -66,5 +66,5 @@ void net_hostname_init(void)
{
	memcpy(hostname, CONFIG_NET_HOSTNAME, sizeof(CONFIG_NET_HOSTNAME) - 1);

	NET_DBG("Hostname set to %s", hostname);
	NET_DBG("Hostname set to %s", CONFIG_NET_HOSTNAME);
}