diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2017-11-07 16:36:33 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-11-09 10:12:15 +0100 |
commit | 974f21eca37934eb035ad214121190d280895cca (patch) | |
tree | 1326f6c61dc0442745611036f154b7fcd5865907 /src/nm-checkpoint-manager.c | |
parent | 66d048023c780f6581a568b46efa29b1fadd7dbc (diff) | |
download | NetworkManager-974f21eca37934eb035ad214121190d280895cca.tar.gz |
checkpoint: don't include unrealized devices
Don't include unrealized devices in checkpoint because, as the name
says, they are not real.
While at it, remove nm_manager_get_device_paths() as it is no longer
used.
Diffstat (limited to 'src/nm-checkpoint-manager.c')
-rw-r--r-- | src/nm-checkpoint-manager.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/nm-checkpoint-manager.c b/src/nm-checkpoint-manager.c index 46d6a14019..6da220c4cc 100644 --- a/src/nm-checkpoint-manager.c +++ b/src/nm-checkpoint-manager.c @@ -153,7 +153,23 @@ nm_checkpoint_manager_create (NMCheckpointManager *self, manager = GET_MANAGER (self); if (!device_paths || !device_paths[0]) { - device_paths_free = nm_manager_get_device_paths (manager); + const char *device_path; + const GSList *iter; + GPtrArray *paths; + + paths = g_ptr_array_new (); + for (iter = nm_manager_get_devices (manager); + iter; + iter = g_slist_next (iter)) { + device = NM_DEVICE (iter->data); + if (!nm_device_is_real (device)) + continue; + device_path = nm_exported_object_get_path (NM_EXPORTED_OBJECT (device)); + if (device_path) + g_ptr_array_add (paths, (gpointer) device_path); + } + g_ptr_array_add (paths, NULL); + device_paths_free = (const char **) g_ptr_array_free (paths, FALSE); device_paths = (const char *const *) device_paths_free; } else if (NM_FLAGS_HAS (flags, NM_CHECKPOINT_CREATE_FLAG_DISCONNECT_NEW_DEVICES)) { g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_INVALID_ARGUMENTS, |