summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-04-04 19:48:39 +0200
committerThomas Haller <thaller@redhat.com>2016-04-04 21:27:05 +0200
commitc5d827057e71e349a02922982323d2e8a85081c8 (patch)
tree6333b5509ed806e91296318dc6c8418bf9341875
parentfe6940b692bc3a6444055c4c3ab50eb256f3923e (diff)
downloadNetworkManager-c5d827057e71e349a02922982323d2e8a85081c8.tar.gz
device: ensure @error always set by nm_device_factory_create_device()
https://bugzilla.gnome.org/show_bug.cgi?id=764606
-rw-r--r--src/devices/nm-device-factory.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c
index 5ce4333f58..9dfa9bcbac 100644
--- a/src/devices/nm-device-factory.c
+++ b/src/devices/nm-device-factory.c
@@ -91,6 +91,8 @@ nm_device_factory_create_device (NMDeviceFactory *factory,
const NMLinkType *link_types = NULL;
const char **setting_types = NULL;
int i;
+ NMDevice *device;
+ gboolean ignore = FALSE;
g_return_val_if_fail (factory, NULL);
g_return_val_if_fail (iface && *iface, NULL);
@@ -99,6 +101,8 @@ nm_device_factory_create_device (NMDeviceFactory *factory,
nm_device_factory_get_supported_types (factory, &link_types, &setting_types);
+ NM_SET_OUT (out_ignore, FALSE);
+
if (plink) {
g_return_val_if_fail (strcmp (iface, plink->name) == 0, NULL);
@@ -137,7 +141,20 @@ nm_device_factory_create_device (NMDeviceFactory *factory,
return NULL;
}
- return interface->create_device (factory, iface, plink, connection, out_ignore);
+ device = interface->create_device (factory, iface, plink, connection, &ignore);
+ NM_SET_OUT (out_ignore, ignore);
+ if (!device) {
+ if (ignore) {
+ g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED,
+ "Device factory %s ignores device %s",
+ G_OBJECT_TYPE_NAME (factory), iface);
+ } else {
+ g_set_error (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_FAILED,
+ "Device factory %s failed to create device %s",
+ G_OBJECT_TYPE_NAME (factory), iface);
+ }
+ }
+ return device;
}
const char *