From 93e4e0f8a1e911d5c8e6023330512a5266cc089f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sun, 23 Feb 2014 22:29:09 +0100 Subject: [PATCH] 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 --- src/devices/nm-device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 636ff3f874..0d6e28442b 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -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. */