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:
Thomas Haller 2014-02-23 22:29:09 +01:00
parent dd2ce3dfbc
commit 93e4e0f8a1

View file

@ -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. */