diff options
Diffstat (limited to 'netspeed')
| -rw-r--r-- | netspeed/help/tzm/tzm.po | 2 | ||||
| -rw-r--r-- | netspeed/src/backend.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/netspeed/help/tzm/tzm.po b/netspeed/help/tzm/tzm.po index 07042c52e..af300ffc6 100644 --- a/netspeed/help/tzm/tzm.po +++ b/netspeed/help/tzm/tzm.po @@ -13,7 +13,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: tzm\n" -"Plural-Forms: nplurals=2; plural=(n == 0 || n == 1 || (n > 10 && n < 100) ? 0 : 1;\n" +"Plural-Forms: nplurals=2; plural=n >= 2 && (n < 11 || n > 99);\n" #. Put one translator per line, in the form NAME <EMAIL>, YEAR1, YEAR2 msgctxt "_" diff --git a/netspeed/src/backend.c b/netspeed/src/backend.c index e13214977..cd3692005 100644 --- a/netspeed/src/backend.c +++ b/netspeed/src/backend.c @@ -64,10 +64,20 @@ struct nl80211_state { #endif /* HAVE_NL */ +static gboolean +device_exists (const char *device) +{ + return (if_nametoindex (device) != 0); +} + gboolean is_dummy_device (const char* device) { glibtop_netload netload; + + if (!device_exists (device)) + return TRUE; + glibtop_get_netload (&netload, device); if (netload.if_flags & (1 << GLIBTOP_IF_FLAGS_LOOPBACK)) @@ -332,6 +342,11 @@ get_device_info (const char *device, devinfo->name = g_strdup (device); devinfo->type = DEV_UNKNOWN; + /* Device doesn't exist. + * Return so the auto-change logic can find an active device. */ + if (!device_exists (device)) + return; + glibtop_get_netload (&netload, device); devinfo->up = (netload.if_flags & (1L << GLIBTOP_IF_FLAGS_UP) ? TRUE : FALSE); |
