summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-01-08 12:12:28 +0100
committerThomas Haller <thaller@redhat.com>2021-01-08 12:17:08 +0100
commitf8026717e4cea0053b8dca497d8e377850d565c0 (patch)
tree4912c3b7a1f5eb53454325baccb778f08444840d
parent123765befcad75e1a77d2d8f0e2e1971b925c28e (diff)
downloadNetworkManager-f8026717e4cea0053b8dca497d8e377850d565c0.tar.gz
core: avoid "-Wmaybe-uninitialized" warning in update_system_hostname() with LTO
When building without more-assertions and LTO, the compiler might think that "wait" is uninitialized. Avoid the warning. Initializing a variable is not a great solution either, because potentially it could hide an actual bug. But it still seems to be best. src/nm-policy.c: In function update_system_hostname: src/nm-policy.c:909: warning: wait may be used uninitialized in this function [-Wmaybe-uninitialized] 909 | if (wait) { | src/nm-policy.c:901: note: wait was declared here 901 | gboolean wait; |
-rw-r--r--src/nm-policy.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c
index f2a3b0bf80..cda22b1030 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -898,7 +898,7 @@ update_system_hostname(NMPolicy *self, const char *msg)
if (info->from_dns && info->ip_x[IS_IPv4]) {
const char *result;
- gboolean wait;
+ gboolean wait = FALSE;
result =
nm_device_get_hostname_from_dns_lookup(info->device, addr_family, &wait);