summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-10-26 13:50:41 +0200
committerThomas Haller <thaller@redhat.com>2022-10-26 13:50:50 +0200
commit8e3202e499464b2f910c0afd12a2700f4722a17f (patch)
treee447fae26489694c66ce6a5b963ceb7ff3a12cb3
parent63f4783c59e8dc56cd44ab03e9608648fa169c52 (diff)
downloadNetworkManager-8e3202e499464b2f910c0afd12a2700f4722a17f.tar.gz
policy: refactor all_devices_not_active() to any_devices_active()
The double negation is hard to understand.
-rw-r--r--src/core/nm-policy.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
index f666df5e2d..c12cd8c476 100644
--- a/src/core/nm-policy.c
+++ b/src/core/nm-policy.c
@@ -457,7 +457,7 @@ get_best_active_connection(NMPolicy *self, int addr_family, gboolean fully_activ
}
static gboolean
-all_devices_not_active(NMPolicy *self)
+any_devices_active(NMPolicy *self)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
const CList *tmp_lst;
@@ -470,9 +470,9 @@ all_devices_not_active(NMPolicy *self)
if (state <= NM_DEVICE_STATE_DISCONNECTED || state >= NM_DEVICE_STATE_DEACTIVATING) {
continue;
}
- return FALSE;
+ return TRUE;
}
- return TRUE;
+ return FALSE;
}
#define FALLBACK_HOSTNAME4 "localhost.localdomain"
@@ -606,7 +606,7 @@ _set_hostname(NMPolicy *self, const char *new_hostname, const char *msg)
priv->updating_dns = TRUE;
nm_dns_manager_set_hostname(priv->dns_manager,
priv->cur_hostname_full,
- all_devices_not_active(self));
+ !any_devices_active(self));
priv->updating_dns = FALSE;
}