mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-05 08:00:15 +01:00
device: workaround coverity warning
Coverity doesn't like this. Refactor a bit, hoping that it fares better.
1. Defect type: ASSERT_SIDE_EFFECT
1. NetworkManager-1.9.2/src/devices/nm-device.c:10226: assignment_where_comparison_intended: Assignment "ip_ifindex = nm_device_get_ip_ifindex(self)" has a side effect. This code will work differently in a non-debug build.
2. NetworkManager-1.9.2/src/devices/nm-device.c:10226: remediation: Did you intend to use a comparison ("==") instead?
This commit is contained in:
parent
449940af1d
commit
62a57dab49
1 changed files with 12 additions and 6 deletions
|
|
@ -10054,7 +10054,6 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
NMIP4Config *old_config = NULL;
|
||||
gboolean has_changes = FALSE;
|
||||
gboolean success = TRUE;
|
||||
int ip_ifindex = 0;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||
|
||||
|
|
@ -10063,8 +10062,12 @@ nm_device_set_ip4_config (NMDevice *self,
|
|||
|
||||
nm_assert ( !new_config
|
||||
|| ( new_config
|
||||
&& ((ip_ifindex = nm_device_get_ip_ifindex (self)) > 0)
|
||||
&& ip_ifindex == nm_ip4_config_get_ifindex (new_config)));
|
||||
&& ({
|
||||
int ip_ifindex = nm_device_get_ip_ifindex (self);
|
||||
|
||||
( ip_ifindex > 0
|
||||
&& ip_ifindex == nm_ip4_config_get_ifindex (new_config));
|
||||
})));
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
|
|
@ -10226,7 +10229,6 @@ nm_device_set_ip6_config (NMDevice *self,
|
|||
NMIP6Config *old_config = NULL;
|
||||
gboolean has_changes = FALSE;
|
||||
gboolean success = TRUE;
|
||||
int ip_ifindex = 0;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||
|
||||
|
|
@ -10235,8 +10237,12 @@ nm_device_set_ip6_config (NMDevice *self,
|
|||
|
||||
nm_assert ( !new_config
|
||||
|| ( new_config
|
||||
&& ((ip_ifindex = nm_device_get_ip_ifindex (self)) > 0)
|
||||
&& ip_ifindex == nm_ip6_config_get_ifindex (new_config)));
|
||||
&& ({
|
||||
int ip_ifindex = nm_device_get_ip_ifindex (self);
|
||||
|
||||
( ip_ifindex > 0
|
||||
&& ip_ifindex == nm_ip6_config_get_ifindex (new_config));
|
||||
})));
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue