From 8766d05ea946cbaeca69322607a8e4c2d969c28b Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Thu, 10 Oct 2019 15:37:45 +0200 Subject: [PATCH] cli/devices: on connecting a device, don't uselessly look it up from the ac For quite some time we already pass the AddAndActivateInfo for device connect too, and that one remembers the device. --- clients/cli/devices.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 2d265c8e46..e89c0c3747 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -1940,9 +1940,8 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data) nm_auto_free_add_and_activate_info AddAndActivateInfo *info = user_data; NmCli *nmc = info->nmc; gs_unref_object NMActiveConnection *active = NULL; + NMDevice *device = info->device; GError *error = NULL; - const GPtrArray *devices; - NMDevice *device; active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error); @@ -1964,16 +1963,6 @@ connect_device_cb (GObject *client, GAsyncResult *result, gpointer user_data) nm_assert (NM_IS_ACTIVE_CONNECTION (active)); - devices = nm_active_connection_get_devices (active); - if (devices->len == 0) { - g_string_printf (nmc->return_text, _("Error: Device activation failed: device was disconnected")); - nmc->return_value = NMC_RESULT_ERROR_CON_ACTIVATION; - quit (); - return; - } - - device = g_ptr_array_index (devices, 0); - if (nmc->nowait_flag) { quit (); return;