diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2017-02-27 15:47:43 +0100 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2017-03-24 15:18:08 +0100 |
commit | b7557fa723991f6f49505794e39f9bddd22555a6 (patch) | |
tree | 3b3f5a8fa8d24d3c2c60b01f61b5b11c026d7acb | |
parent | bdd2e1c2aa0c8340743b307c3e78b38cda2a6934 (diff) | |
download | NetworkManager-b7557fa723991f6f49505794e39f9bddd22555a6.tar.gz |
policy: remove redundant check in _set_hostname
This will allow also to remove the hostname_changed var from
NMPolicyPrivate struct.
-rw-r--r-- | src/nm-policy.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c index ff93c9853d..5b04e7f231 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -87,7 +87,6 @@ typedef struct { char *orig_hostname; /* hostname at NM start time */ char *cur_hostname; /* hostname we want to assign */ - gboolean hostname_changed; /* TRUE if NM ever set the hostname */ GArray *ip6_prefix_delegations; /* pool of ip6 prefixes delegated to all devices */ } NMPolicyPrivate; @@ -492,20 +491,12 @@ _set_hostname (NMPolicy *self, if (new_hostname) g_clear_object (&priv->lookup_addr); - if ( priv->orig_hostname - && (priv->hostname_changed == FALSE) - && g_strcmp0 (priv->orig_hostname, new_hostname) == 0) { - /* Don't change the hostname or update DNS this is the first time we're - * trying to change the hostname, and it's not actually changing. - */ - } else if (g_strcmp0 (priv->cur_hostname, new_hostname) == 0) { - /* Don't change the hostname or update DNS if the hostname isn't actually - * going to change. - */ - } else { + /* Update the DNS only if the hostname is actually + * going to change. + */ + if (!nm_streq0 (priv->cur_hostname, new_hostname)) { g_free (priv->cur_hostname); priv->cur_hostname = g_strdup (new_hostname); - priv->hostname_changed = TRUE; /* Notify the DNS manager of the hostname change so that the domain part, if * present, can be added to the search list. |