From f8026717e4cea0053b8dca497d8e377850d565c0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 8 Jan 2021 12:12:28 +0100 Subject: [PATCH] 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; | --- src/nm-policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-policy.c b/src/nm-policy.c index f2a3b0bf8..cda22b103 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);