diff options
author | Thomas Haller <thaller@redhat.com> | 2014-02-23 22:29:09 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2014-02-23 22:31:49 +0100 |
commit | 93e4e0f8a1e911d5c8e6023330512a5266cc089f (patch) | |
tree | 2ec6e1d856160fad97eb5453e4ab45b49cfc5096 | |
parent | dd2ce3dfbc36181486c8d00aa6ce5e41fadbbe65 (diff) | |
download | NetworkManager-93e4e0f8a1e911d5c8e6023330512a5266cc089f.tar.gz |
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>
-rw-r--r-- | src/devices/nm-device.c | 4 |
1 files 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. */ |