diff options
author | Thomas Haller <thaller@redhat.com> | 2017-04-23 20:31:31 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-12 17:29:33 +0200 |
commit | af5b86aa1ec59f9215604e55e2d3ee0026d718ff (patch) | |
tree | e8892b5e57da7dec0da8226a101baebf1c9beac2 | |
parent | 25c5a96da7f26df14131bad44703a44eb89c26ff (diff) | |
download | NetworkManager-af5b86aa1ec59f9215604e55e2d3ee0026d718ff.tar.gz |
policy: log policy's orig_hostname
-rw-r--r-- | src/dns/nm-dns-manager.c | 1 | ||||
-rw-r--r-- | src/nm-policy.c | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/dns/nm-dns-manager.c b/src/dns/nm-dns-manager.c index 1f6c2eede4..cc9be29e7f 100644 --- a/src/dns/nm-dns-manager.c +++ b/src/dns/nm-dns-manager.c @@ -1435,6 +1435,7 @@ nm_dns_manager_set_initial_hostname (NMDnsManager *self, { NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); + g_free (priv->hostname); priv->hostname = g_strdup (hostname); } diff --git a/src/nm-policy.c b/src/nm-policy.c index 3b27b2063d..2d17bf3af0 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -629,13 +629,14 @@ update_system_hostname (NMPolicy *self, NMDevice *best4, NMDevice *best6, const temp_hostname); priv->dhcp_hostname = FALSE; + if (!nm_utils_is_specific_hostname (temp_hostname)) + nm_clear_g_free (&temp_hostname); if (!nm_streq0 (temp_hostname, priv->orig_hostname)) { /* Update original (fallback) hostname */ g_free (priv->orig_hostname); - if (nm_utils_is_specific_hostname (temp_hostname)) - priv->orig_hostname = g_steal_pointer (&temp_hostname); - else - priv->orig_hostname = NULL; + priv->orig_hostname = g_steal_pointer (&temp_hostname); + _LOGT (LOGD_DNS, "hostname-original: update to %s%s%s", + NM_PRINT_FMT_QUOTE_STRING (priv->orig_hostname)); } } @@ -2347,6 +2348,8 @@ constructed (GObject *object) if (nm_utils_is_specific_hostname (hostname)) priv->orig_hostname = g_strdup (hostname); } + _LOGT (LOGD_DNS, "hostname-original: set to %s%s%s", + NM_PRINT_FMT_QUOTE_STRING (priv->orig_hostname)); priv->firewall_manager = g_object_ref (nm_firewall_manager_get ()); g_signal_connect (priv->firewall_manager, NM_FIREWALL_MANAGER_STATE_CHANGED, |