mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 17:00:08 +01:00
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:823df334ed(cherry picked from commitbccc1af51b)
This commit is contained in:
parent
431bbb01b4
commit
677ba11a0f
1 changed files with 3 additions and 9 deletions
|
|
@ -2608,15 +2608,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue