mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 12:00:11 +01:00
connectivity: avoid uninitialized variable warning in nm_connectivity_check_start()
In file included from ./src/libnm-std-aux/nm-default-std.h:102,
from ./src/libnm-glib-aux/nm-default-glib.h:11,
from ./src/libnm-glib-aux/nm-default-glib-i18n-prog.h:13,
from ./src/core/nm-default-daemon.h:11,
from src/core/nm-connectivity.c:8:
src/core/nm-connectivity.c: In function ‘nm_connectivity_check_start’:
./src/libnm-std-aux/nm-std-aux.h:180:12: error: ‘reason’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (expr) \
^
src/core/nm-connectivity.c:1055:29: note: ‘reason’ was declared here
const char *reason;
^~~~~~
This commit is contained in:
parent
40dd8bf93a
commit
54c23f440b
1 changed files with 6 additions and 12 deletions
|
|
@ -981,9 +981,7 @@ check_platform_config(NMConnectivity *self,
|
|||
return NM_CONNECTIVITY_NONE;
|
||||
}
|
||||
|
||||
switch (addr_family) {
|
||||
case AF_INET:
|
||||
{
|
||||
if (NM_IS_IPv4(addr_family)) {
|
||||
const NMPlatformIP4Route *route;
|
||||
gboolean found_global = FALSE;
|
||||
NMDedupMultiIter iter;
|
||||
|
|
@ -1002,13 +1000,8 @@ check_platform_config(NMConnectivity *self,
|
|||
NM_SET_OUT(reason, "no global route configured");
|
||||
return NM_CONNECTIVITY_LIMITED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AF_INET6:
|
||||
} else {
|
||||
/* Route scopes aren't meaningful for IPv6 so any route is fine. */
|
||||
break;
|
||||
default:
|
||||
g_return_val_if_reached(FALSE);
|
||||
}
|
||||
|
||||
NM_SET_OUT(reason, NULL);
|
||||
|
|
@ -1050,11 +1043,12 @@ nm_connectivity_check_start(NMConnectivity *self,
|
|||
cb_data->concheck.con_config = _con_config_ref(priv->con_config);
|
||||
|
||||
if (iface && ifindex > 0 && priv->enabled && priv->uri_valid) {
|
||||
gboolean has_systemd_resolved;
|
||||
NMConnectivityState state;
|
||||
const char *reason;
|
||||
gboolean has_systemd_resolved;
|
||||
|
||||
if (platform) {
|
||||
const char *reason;
|
||||
NMConnectivityState state;
|
||||
|
||||
state = check_platform_config(self, platform, ifindex, addr_family, &reason);
|
||||
nm_assert((state == NM_CONNECTIVITY_UNKNOWN) == !reason);
|
||||
if (state != NM_CONNECTIVITY_UNKNOWN) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue