mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-07 02:50:30 +01:00
core: minor fix to ensure we call platform functions with positive ifindex
Actually, get_ip_ifindex() should always return 0 or > 0. Just in case, be extra careful and modify the conditions. Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
dd2ce3dfbc
commit
93e4e0f8a1
1 changed files with 2 additions and 2 deletions
|
|
@ -665,7 +665,7 @@ is_up (NMDevice *device)
|
|||
{
|
||||
int ifindex = nm_device_get_ip_ifindex (device);
|
||||
|
||||
return ifindex ? nm_platform_link_is_up (ifindex) : TRUE;
|
||||
return ifindex > 0 ? nm_platform_link_is_up (ifindex) : TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -5426,7 +5426,7 @@ take_down (NMDevice *device)
|
|||
{
|
||||
int ifindex = nm_device_get_ip_ifindex (device);
|
||||
|
||||
if (ifindex)
|
||||
if (ifindex > 0)
|
||||
return nm_platform_link_set_down (ifindex);
|
||||
|
||||
/* devices without ifindex are always up. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue