From bccc1af51b768cd5a2f9268f6cf57d5cc06a9a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Thu, 13 Aug 2015 09:48:12 +0200 Subject: [PATCH] cli: fix an bug when reporting an error $ nmcli dev wifi rescan ifname eteee (process:21211): libnm-CRITICAL **: nm_device_get_device_type: assertion 'NM_IS_DEVICE (self)' failed Error: Device 'eteee' is not a Wi-Fi device. Fixes: 823df334eda48a8e2cec897d6123f7b2158c12ff --- clients/cli/devices.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 740e3234a..c10febdd9 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -2533,15 +2533,9 @@ do_device_wifi_rescan (NmCli *nmc, int argc, char **argv) device = find_wifi_device_by_iface (devices, ifname, &devices_idx); if (!device) { - if (ifname) { - const char *err_msg; - if ( nm_device_get_device_type (device) == NM_DEVICE_TYPE_GENERIC - && g_strcmp0 (nm_device_get_type_description (device), "wifi") == 0) - err_msg = _("Error: Device '%s' was not recognized as a Wi-Fi device, check NetworkManager Wi-Fi plugin."); - else - err_msg = _("Error: Device '%s' is not a Wi-Fi device."); - g_string_printf (nmc->return_text, err_msg, ifname); - } else + if (ifname) + g_string_printf (nmc->return_text, _("Error: Device '%s' is not a Wi-Fi device."), ifname); + else g_string_printf (nmc->return_text, _("Error: No Wi-Fi device found.")); nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; goto error;