mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 06:00:18 +01:00
core: allow NULL device path in ActivateConnection
This commit is contained in:
parent
92b29f399b
commit
da4928aea7
1 changed files with 10 additions and 3 deletions
|
|
@ -346,6 +346,8 @@ nm_manager_get_device_by_udi (NMManager *manager, const char *udi)
|
|||
{
|
||||
GSList *iter;
|
||||
|
||||
g_return_val_if_fail (udi != NULL, NULL);
|
||||
|
||||
for (iter = NM_MANAGER_GET_PRIVATE (manager)->devices; iter; iter = iter->next) {
|
||||
if (!strcmp (nm_device_get_udi (NM_DEVICE (iter->data)), udi))
|
||||
return NM_DEVICE (iter->data);
|
||||
|
|
@ -358,6 +360,8 @@ nm_manager_get_device_by_path (NMManager *manager, const char *path)
|
|||
{
|
||||
GSList *iter;
|
||||
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
|
||||
for (iter = NM_MANAGER_GET_PRIVATE (manager)->devices; iter; iter = iter->next) {
|
||||
if (!strcmp (nm_device_get_path (NM_DEVICE (iter->data)), path))
|
||||
return NM_DEVICE (iter->data);
|
||||
|
|
@ -673,7 +677,7 @@ pending_activation_new (NMManager *manager,
|
|||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
||||
PendingActivation *pending;
|
||||
NMDevice *device;
|
||||
NMDevice *device = NULL;
|
||||
NMConnection *connection = NULL;
|
||||
GSList *all_connections = NULL;
|
||||
gboolean success;
|
||||
|
|
@ -683,13 +687,16 @@ pending_activation_new (NMManager *manager,
|
|||
g_return_val_if_fail (context != NULL, NULL);
|
||||
g_return_val_if_fail (device_path != NULL, NULL);
|
||||
|
||||
/* A specific object path of "/" means NULL */
|
||||
/* A object path of "/" means NULL */
|
||||
if (g_strcmp0 (specific_object_path, "/") == 0)
|
||||
specific_object_path = NULL;
|
||||
if (g_strcmp0 (device_path, "/") == 0)
|
||||
device_path = NULL;
|
||||
|
||||
/* Create the partial connection from the given settings */
|
||||
if (settings) {
|
||||
device = nm_manager_get_device_by_path (manager, device_path);
|
||||
if (device_path)
|
||||
device = nm_manager_get_device_by_path (manager, device_path);
|
||||
if (!device) {
|
||||
g_set_error_literal (error,
|
||||
NM_MANAGER_ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue